forked from forgejo/forgejo
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:
parent
f2439b7e4c
commit
4698a1ec47
4 changed files with 42 additions and 5 deletions
|
@ -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 == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue