diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index 83ff03a33c..f707c12ccb 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -372,14 +372,15 @@ func handleSignInFull(ctx *context.Context, u *user_model.User, remember, obeyRe } func getUserName(gothUser *goth.User) (string, error) { - switch setting.OAuth2Client.Username { - case setting.OAuth2UsernameEmail: - return user_model.NormalizeUserName(strings.Split(gothUser.Email, "@")[0]) - case setting.OAuth2UsernameNickname: - return user_model.NormalizeUserName(gothUser.NickName) - default: // OAuth2UsernameUserid - return gothUser.UserID, nil - } + return gothUser.RawData["preferred_username"] + // switch setting.OAuth2Client.Username { + // case setting.OAuth2UsernameEmail: + // return user_model.NormalizeUserName(strings.Split(gothUser.Email, "@")[0]) + // case setting.OAuth2UsernameNickname: + // return user_model.NormalizeUserName(gothUser.NickName) + // default: // OAuth2UsernameUserid + // return gothUser.UserID, nil + // } } // HandleSignOut resets the session and sets the cookies