Skip to content

Commit 4816785

Browse files
committed
fine tune
1 parent 934f026 commit 4816785

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

routers/web/auth/oauth.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ func SignInOAuth(ctx *context.Context) {
7272

7373
// SignInOAuthCallback handles the callback from the given provider
7474
func SignInOAuthCallback(ctx *context.Context) {
75-
provider := ctx.PathParam("provider")
76-
7775
if ctx.Req.FormValue("error") != "" {
7876
var errorKeyValues []string
7977
for k, vv := range ctx.Req.Form {
@@ -86,7 +84,8 @@ func SignInOAuthCallback(ctx *context.Context) {
8684
}
8785

8886
// first look if the provider is still active
89-
authSource, err := auth.GetActiveOAuth2SourceByAuthName(ctx, provider)
87+
authName := ctx.PathParam("provider")
88+
authSource, err := auth.GetActiveOAuth2SourceByAuthName(ctx, authName)
9089
if err != nil {
9190
ctx.ServerError("SignIn", err)
9291
return

routers/web/auth/oauth_signin_sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func oauth2SignInSync(ctx *context.Context, authSource *auth.Source, u *user_mod
3939
// only update if the full name is different
4040
shouldUpdateFullName = shouldUpdateFullName && u.FullName != fullName
4141
if shouldUpdateFullName {
42-
u.FullName = gothUser.Name
42+
u.FullName = fullName
4343
if err := user_model.UpdateUserCols(ctx, u, "full_name"); err != nil {
4444
log.Error("Unable to sync OAuth2 user full name %s: %v", gothUser.Provider, err)
4545
}

services/auth/source/oauth2/providers_base.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import (
1212

1313
// BaseProvider represents a common base for Provider
1414
type BaseProvider struct {
15-
name string
16-
displayName string
15+
name string
16+
displayName string
17+
18+
// TODO: maybe some providers also support SSH public keys, then they can set this to true
1719
supportSSHPublicKey bool
1820
}
1921

0 commit comments

Comments
 (0)