Skip to content

Commit 16034bb

Browse files
authored
OAuth2 login: Set account link to "login" as default behavior (#15768)
1 parent 8f0539c commit 16034bb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ UPDATE_AVATAR = false
641641
; disabled = show an error
642642
; login = show an account linking login
643643
; auto = link directly with the account
644-
ACCOUNT_LINKING = disabled
644+
ACCOUNT_LINKING = login
645645

646646
[service]
647647
; Time limit to confirm account/email registration

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ relation to port exhaustion.
440440
- nickname - use the nickname attribute
441441
- email - use the username part of the email attribute
442442
- `UPDATE_AVATAR`: **false**: Update avatar if available from oauth2 provider. Update will be performed on each login.
443-
- `ACCOUNT_LINKING`: **disabled**: How to handle if an account / email already exists:
443+
- `ACCOUNT_LINKING`: **login**: How to handle if an account / email already exists:
444444
- disabled - show an error
445445
- login - show an account linking login
446446
- auto - automatically link with the account (Please be aware that this will grant access to an existing account just because the same username or email is provided. You must make sure that this does not cause issues with your authentication providers.)

modules/setting/oauth2_client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func newOAuth2Client() {
7171
OAuth2Client.Username = OAuth2UsernameNickname
7272
}
7373
OAuth2Client.UpdateAvatar = sec.Key("UPDATE_AVATAR").MustBool()
74-
OAuth2Client.AccountLinking = OAuth2AccountLinkingType(sec.Key("ACCOUNT_LINKING").MustString(string(OAuth2AccountLinkingDisabled)))
74+
OAuth2Client.AccountLinking = OAuth2AccountLinkingType(sec.Key("ACCOUNT_LINKING").MustString(string(OAuth2AccountLinkingLogin)))
7575
if !OAuth2Client.AccountLinking.isValid() {
76-
log.Warn("Account linking setting is not valid: '%s', will fallback to '%s'", OAuth2Client.AccountLinking, OAuth2AccountLinkingDisabled)
77-
OAuth2Client.AccountLinking = OAuth2AccountLinkingDisabled
76+
log.Warn("Account linking setting is not valid: '%s', will fallback to '%s'", OAuth2Client.AccountLinking, OAuth2AccountLinkingLogin)
77+
OAuth2Client.AccountLinking = OAuth2AccountLinkingLogin
7878
}
7979
}
8080

0 commit comments

Comments
 (0)