mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Adding button to link accounts from user settings (#19792)
* Adding button to link accounts from user settings * Only display button to link user accounts when at least one OAuth2 provider is active
This commit is contained in:
@@ -847,7 +847,17 @@ func SignInOAuthCallback(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if u == nil {
|
||||
if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
|
||||
if ctx.Doer != nil {
|
||||
// attach user to already logged in user
|
||||
err = externalaccount.LinkAccountToUser(ctx.Doer, gothUser)
|
||||
if err != nil {
|
||||
ctx.ServerError("UserLinkAccount", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||
return
|
||||
} else if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
|
||||
// create new user with details from oauth2 provider
|
||||
var missingFields []string
|
||||
if gothUser.UserID == "" {
|
||||
|
Reference in New Issue
Block a user