Change how username is retrieved from SSO
Some checks failed
mirror / mirror (push) Has been skipped
testing / lint-backend (push) Failing after 6m40s
testing / checks-backend (push) Failing after 3m57s
testing / test-unit (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
Some checks failed
mirror / mirror (push) Has been skipped
testing / lint-backend (push) Failing after 6m40s
testing / checks-backend (push) Failing after 3m57s
testing / test-unit (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
This commit is contained in:
parent
623f13f2dc
commit
2488750ea4
1 changed files with 9 additions and 8 deletions
|
@ -372,14 +372,15 @@ func handleSignInFull(ctx *context.Context, u *user_model.User, remember, obeyRe
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUserName(gothUser *goth.User) (string, error) {
|
func getUserName(gothUser *goth.User) (string, error) {
|
||||||
switch setting.OAuth2Client.Username {
|
return gothUser.RawData["preferred_username"]
|
||||||
case setting.OAuth2UsernameEmail:
|
// switch setting.OAuth2Client.Username {
|
||||||
return user_model.NormalizeUserName(strings.Split(gothUser.Email, "@")[0])
|
// case setting.OAuth2UsernameEmail:
|
||||||
case setting.OAuth2UsernameNickname:
|
// return user_model.NormalizeUserName(strings.Split(gothUser.Email, "@")[0])
|
||||||
return user_model.NormalizeUserName(gothUser.NickName)
|
// case setting.OAuth2UsernameNickname:
|
||||||
default: // OAuth2UsernameUserid
|
// return user_model.NormalizeUserName(gothUser.NickName)
|
||||||
return gothUser.UserID, nil
|
// default: // OAuth2UsernameUserid
|
||||||
}
|
// return gothUser.UserID, nil
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleSignOut resets the session and sets the cookies
|
// HandleSignOut resets the session and sets the cookies
|
||||||
|
|
Loading…
Reference in a new issue