fix: spelling
This commit is contained in:
@@ -277,7 +277,7 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//绑定, user preffered_username as username
|
//绑定, 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 {
|
if err != nil {
|
||||||
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "BindFail"))
|
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "BindFail"))
|
||||||
return
|
return
|
||||||
@@ -295,7 +295,7 @@ func (o *Oauth) OauthCallback(c *gin.Context) {
|
|||||||
if !*oa.AutoRegister {
|
if !*oa.AutoRegister {
|
||||||
//c.String(http.StatusInternalServerError, "还未绑定用户,请先绑定")
|
//c.String(http.StatusInternalServerError, "还未绑定用户,请先绑定")
|
||||||
|
|
||||||
v.ThirdName = userData.PrefferedUsername
|
v.ThirdName = userData.PreferredUsername
|
||||||
v.ThirdOpenId = userData.Sub
|
v.ThirdOpenId = userData.Sub
|
||||||
url := global.Config.Rustdesk.ApiServer + "/_admin/#/oauth/bind/" + cacheKey
|
url := global.Config.Rustdesk.ApiServer + "/_admin/#/oauth/bind/" + cacheKey
|
||||||
c.Redirect(http.StatusFound, url)
|
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 {
|
if u.Id == 0 {
|
||||||
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "OauthRegisterFailed"))
|
c.String(http.StatusInternalServerError, response.TranslateMsg(c, "OauthRegisterFailed"))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ type OidcUserdata struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
VerifiedEmail bool `json:"email_verified"`
|
VerifiedEmail bool `json:"email_verified"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
PrefferedUsername string `json:"preffered_username"`
|
PreferredUsername string `json:"preferred_username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OauthCacheItem struct {
|
type OauthCacheItem struct {
|
||||||
|
|||||||
@@ -224,9 +224,9 @@ func (us *UserService) RegisterByGoogle(name string, email string) *model.User {
|
|||||||
return us.RegisterByOauth(model.OauthTypeGoogle, name, email)
|
return us.RegisterByOauth(model.OauthTypeGoogle, name, email)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterByOidc 注册, use prefferedUsername as username, sub as openid
|
// RegisterByOidc 注册, use PreferredUsername as username, sub as openid
|
||||||
func (us *UserService) RegisterByOidc(prefferedUsername string, sub string) *model.User {
|
func (us *UserService) RegisterByOidc(PreferredUsername string, sub string) *model.User {
|
||||||
return us.RegisterByOauth(model.OauthTypeOidc, prefferedUsername, sub)
|
return us.RegisterByOauth(model.OauthTypeOidc, PreferredUsername, sub)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterByOauth 注册
|
// RegisterByOauth 注册
|
||||||
|
|||||||
Reference in New Issue
Block a user