Skip to content

Commit 47221ad

Browse files
committed
Add more checks for EnableOpenIDSignIn
1 parent b77de5b commit 47221ad

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

routers/user/auth_openid.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ func signInOpenIDVerify(ctx *context.Context) {
250250

251251
// ConnectOpenID shows a form to connect an OpenID URI to an existing account
252252
func ConnectOpenID(ctx *context.Context) {
253+
if !setting.Service.EnableOpenIDSignIn {
254+
ctx.Error(403)
255+
return
256+
}
253257
oid, _ := ctx.Session.Get("openid_verified_uri").(string)
254258
if oid == "" {
255259
ctx.Redirect(setting.AppSubURL + "/user/login/openid")

routers/user/setting_openid.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ const (
2020

2121
// SettingsOpenID renders change user's openid page
2222
func SettingsOpenID(ctx *context.Context) {
23+
24+
if !setting.Service.EnableOpenIDSignIn {
25+
ctx.Error(403)
26+
return
27+
}
28+
2329
ctx.Data["Title"] = ctx.Tr("settings")
2430
ctx.Data["PageIsSettingsOpenID"] = true
2531

@@ -41,7 +47,7 @@ func SettingsOpenID(ctx *context.Context) {
4147
// SettingsOpenIDPost response for change user's openid
4248
func SettingsOpenIDPost(ctx *context.Context, form auth.AddOpenIDForm) {
4349

44-
if !setting.Service.EnableOpenIDSignUp {
50+
if !setting.Service.EnableOpenIDSignIn {
4551
ctx.Error(403)
4652
return
4753
}
@@ -138,7 +144,7 @@ func settingsOpenIDVerify(ctx *context.Context) {
138144

139145
// DeleteOpenID response for delete user's openid
140146
func DeleteOpenID(ctx *context.Context) {
141-
if !setting.Service.EnableOpenIDSignUp {
147+
if !setting.Service.EnableOpenIDSignIn {
142148
ctx.Error(403)
143149
return
144150
}
@@ -156,7 +162,7 @@ func DeleteOpenID(ctx *context.Context) {
156162

157163
// ToggleOpenIDVisibility response for toggle visibility of user's openid
158164
func ToggleOpenIDVisibility(ctx *context.Context) {
159-
if !setting.Service.EnableOpenIDSignUp {
165+
if !setting.Service.EnableOpenIDSignIn {
160166
ctx.Error(403)
161167
return
162168
}

0 commit comments

Comments
 (0)