From 9eff8ea33a7feb84c1b45c5aeec9bf8dba665051 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Tue, 29 Oct 2024 23:00:17 +0800 Subject: [PATCH] fix: spelling --- http/controller/api/ouath.go | 6 +++--- service/oauth.go | 2 +- service/user.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/http/controller/api/ouath.go b/http/controller/api/ouath.go index 7c95e36..674d218 100644 --- a/http/controller/api/ouath.go +++ b/http/controller/api/ouath.go @@ -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 diff --git a/service/oauth.go b/service/oauth.go index 798cda7..ea97608 100644 --- a/service/oauth.go +++ b/service/oauth.go @@ -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 { diff --git a/service/user.go b/service/user.go index 2c938af..0eb8b56 100644 --- a/service/user.go +++ b/service/user.go @@ -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 注册