fix: spelling

This commit is contained in:
Tao Chen
2024-10-29 23:00:17 +08:00
parent 17305b6a6f
commit 9eff8ea33a
3 changed files with 7 additions and 7 deletions

View File

@@ -277,7 +277,7 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
return
}
//绑定, user preffered_username as username
err = service.AllService.OauthService.BindOidcUser(userData.Sub, userData.PrefferedUsername, v.UserId)
err = service.AllService.OauthService.BindOidcUser(userData.Sub, userData.PreferredUsername, v.UserId)
if err != nil {
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "BindFail"))
return
@@ -295,7 +295,7 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
if !*oa.AutoRegister {
//c.String(http.StatusInternalServerError, "还未绑定用户,请先绑定")
v.ThirdName = userData.PrefferedUsername
v.ThirdName = userData.PreferredUsername
v.ThirdOpenId = userData.Sub
url := global.Config.Rustdesk.ApiServer + "/_admin/#/oauth/bind/" + cacheKey
c.Redirect(http.StatusFound, url)
@@ -303,7 +303,7 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
}
//自动注册
u = service.AllService.UserService.RegisterByOidc(userData.PrefferedUsername, userData.Sub)
u = service.AllService.UserService.RegisterByOidc(userData.PreferredUsername, userData.Sub)
if u.Id == 0 {
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "OauthRegisterFailed"))
return

View File

@@ -92,7 +92,7 @@ type OidcUserdata struct {
Email string `json:"email"`
VerifiedEmail bool `json:"email_verified"`
Name string `json:"name"`
PrefferedUsername string `json:"preffered_username"`
PreferredUsername string `json:"preferred_username"`
}
type OauthCacheItem struct {

View File

@@ -224,9 +224,9 @@ func (us *UserService) RegisterByGoogle(name string, email string) *model.User {
return us.RegisterByOauth(model.OauthTypeGoogle, name, email)
}
// RegisterByOidc 注册, use prefferedUsername as username, sub as openid
func (us *UserService) RegisterByOidc(prefferedUsername string, sub string) *model.User {
return us.RegisterByOauth(model.OauthTypeOidc, prefferedUsername, sub)
// RegisterByOidc 注册, use PreferredUsername as username, sub as openid
func (us *UserService) RegisterByOidc(PreferredUsername string, sub string) *model.User {
return us.RegisterByOauth(model.OauthTypeOidc, PreferredUsername, sub)
}
// RegisterByOauth 注册