1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 00:54:28 +00:00

OAuth2 login: Set account link to "login" as default behavior (#15768)

This commit is contained in:
6543 2021-05-07 16:15:16 +02:00 committed by GitHub
parent 8f0539c235
commit 16034bb613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -641,7 +641,7 @@ UPDATE_AVATAR = false
; disabled = show an error ; disabled = show an error
; login = show an account linking login ; login = show an account linking login
; auto = link directly with the account ; auto = link directly with the account
ACCOUNT_LINKING = disabled ACCOUNT_LINKING = login
[service] [service]
; Time limit to confirm account/email registration ; Time limit to confirm account/email registration

View File

@ -440,7 +440,7 @@ relation to port exhaustion.
- nickname - use the nickname attribute - nickname - use the nickname attribute
- email - use the username part of the email attribute - email - use the username part of the email attribute
- `UPDATE_AVATAR`: **false**: Update avatar if available from oauth2 provider. Update will be performed on each login. - `UPDATE_AVATAR`: **false**: Update avatar if available from oauth2 provider. Update will be performed on each login.
- `ACCOUNT_LINKING`: **disabled**: How to handle if an account / email already exists: - `ACCOUNT_LINKING`: **login**: How to handle if an account / email already exists:
- disabled - show an error - disabled - show an error
- login - show an account linking login - login - show an account linking login
- 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.) - 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.)

View File

@ -71,10 +71,10 @@ func newOAuth2Client() {
OAuth2Client.Username = OAuth2UsernameNickname OAuth2Client.Username = OAuth2UsernameNickname
} }
OAuth2Client.UpdateAvatar = sec.Key("UPDATE_AVATAR").MustBool() OAuth2Client.UpdateAvatar = sec.Key("UPDATE_AVATAR").MustBool()
OAuth2Client.AccountLinking = OAuth2AccountLinkingType(sec.Key("ACCOUNT_LINKING").MustString(string(OAuth2AccountLinkingDisabled))) OAuth2Client.AccountLinking = OAuth2AccountLinkingType(sec.Key("ACCOUNT_LINKING").MustString(string(OAuth2AccountLinkingLogin)))
if !OAuth2Client.AccountLinking.isValid() { if !OAuth2Client.AccountLinking.isValid() {
log.Warn("Account linking setting is not valid: '%s', will fallback to '%s'", OAuth2Client.AccountLinking, OAuth2AccountLinkingDisabled) log.Warn("Account linking setting is not valid: '%s', will fallback to '%s'", OAuth2Client.AccountLinking, OAuth2AccountLinkingLogin)
OAuth2Client.AccountLinking = OAuth2AccountLinkingDisabled OAuth2Client.AccountLinking = OAuth2AccountLinkingLogin
} }
} }