diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index 186bd28751..3df2734bb6 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -72,8 +72,6 @@ func SignInOAuth(ctx *context.Context) { // SignInOAuthCallback handles the callback from the given provider func SignInOAuthCallback(ctx *context.Context) { - provider := ctx.PathParam("provider") - if ctx.Req.FormValue("error") != "" { var errorKeyValues []string for k, vv := range ctx.Req.Form { @@ -86,7 +84,8 @@ func SignInOAuthCallback(ctx *context.Context) { } // first look if the provider is still active - authSource, err := auth.GetActiveOAuth2SourceByAuthName(ctx, provider) + authName := ctx.PathParam("provider") + authSource, err := auth.GetActiveOAuth2SourceByAuthName(ctx, authName) if err != nil { ctx.ServerError("SignIn", err) return diff --git a/routers/web/auth/oauth_signin_sync.go b/routers/web/auth/oauth_signin_sync.go index 37bb3460eb..787ea9223c 100644 --- a/routers/web/auth/oauth_signin_sync.go +++ b/routers/web/auth/oauth_signin_sync.go @@ -39,7 +39,7 @@ func oauth2SignInSync(ctx *context.Context, authSource *auth.Source, u *user_mod // only update if the full name is different shouldUpdateFullName = shouldUpdateFullName && u.FullName != fullName if shouldUpdateFullName { - u.FullName = gothUser.Name + u.FullName = fullName if err := user_model.UpdateUserCols(ctx, u, "full_name"); err != nil { log.Error("Unable to sync OAuth2 user full name %s: %v", gothUser.Provider, err) } diff --git a/services/auth/source/oauth2/providers_base.go b/services/auth/source/oauth2/providers_base.go index b14d573baf..d34597d6d9 100644 --- a/services/auth/source/oauth2/providers_base.go +++ b/services/auth/source/oauth2/providers_base.go @@ -12,8 +12,10 @@ import ( // BaseProvider represents a common base for Provider type BaseProvider struct { - name string - displayName string + name string + displayName string + + // TODO: maybe some providers also support SSH public keys, then they can set this to true supportSSHPublicKey bool }