summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2017-03-29 12:57:43 +0200
committerBo-Yi Wu <appleboy.tw@gmail.com>2017-03-29 18:57:43 +0800
commit129b0d6a4b408555c579e7ccb2fb15d3d8fcef29 (patch)
tree88912e81e84c11f1ee7993b9409bf50a23aa7aef /routers
parent08f7fded3c097685af9370283fc8565b80fb0615 (diff)
downloadgitea-129b0d6a4b408555c579e7ccb2fb15d3d8fcef29.tar.gz
gitea-129b0d6a4b408555c579e7ccb2fb15d3d8fcef29.zip
Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION (#1369)
* Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION Omit the configuration variable (the default) to be dependent. Fixes #1363 * Move OpenID settings under Service object * Show OpenID SignUp and SignIn status in admin panel / configuration
Diffstat (limited to 'routers')
-rw-r--r--routers/user/auth_openid.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/routers/user/auth_openid.go b/routers/user/auth_openid.go
index c5575814f1..7d4df342e9 100644
--- a/routers/user/auth_openid.go
+++ b/routers/user/auth_openid.go
@@ -68,8 +68,8 @@ func allowedOpenIDURI(uri string) (err error) {
// In case a Whitelist is present, URI must be in it
// in order to be accepted
- if len(setting.OpenIDWhitelist) != 0 {
- for _, pat := range setting.OpenIDWhitelist {
+ if len(setting.Service.OpenIDWhitelist) != 0 {
+ for _, pat := range setting.Service.OpenIDWhitelist {
if pat.MatchString(uri) {
return nil // pass
}
@@ -79,7 +79,7 @@ func allowedOpenIDURI(uri string) (err error) {
}
// A blacklist match expliclty forbids
- for _, pat := range setting.OpenIDBlacklist {
+ for _, pat := range setting.Service.OpenIDBlacklist {
if pat.MatchString(uri) {
return fmt.Errorf("URI forbidden by blacklist")
}
@@ -231,7 +231,7 @@ func signInOpenIDVerify(ctx *context.Context) {
ctx.Session.Set("openid_determined_username", nickname)
- if u != nil || !setting.EnableOpenIDSignUp {
+ if u != nil || !setting.Service.EnableOpenIDSignUp {
ctx.Redirect(setting.AppSubURL + "/user/openid/connect")
} else {
ctx.Redirect(setting.AppSubURL + "/user/openid/register")
@@ -248,7 +248,7 @@ func ConnectOpenID(ctx *context.Context) {
ctx.Data["Title"] = "OpenID connect"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDConnect"] = true
- ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp
ctx.Data["OpenID"] = oid
userName, _ := ctx.Session.Get("openid_determined_username").(string)
if userName != "" {
@@ -267,7 +267,7 @@ func ConnectOpenIDPost(ctx *context.Context, form auth.ConnectOpenIDForm) {
ctx.Data["Title"] = "OpenID connect"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDConnect"] = true
- ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp
ctx.Data["OpenID"] = oid
u, err := models.UserSignIn(form.UserName, form.Password)
@@ -300,7 +300,7 @@ func ConnectOpenIDPost(ctx *context.Context, form auth.ConnectOpenIDForm) {
// RegisterOpenID shows a form to create a new user authenticated via an OpenID URI
func RegisterOpenID(ctx *context.Context) {
- if !setting.EnableOpenIDSignUp {
+ if !setting.Service.EnableOpenIDSignUp {
ctx.Error(403)
return
}
@@ -312,7 +312,7 @@ func RegisterOpenID(ctx *context.Context) {
ctx.Data["Title"] = "OpenID signup"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDRegister"] = true
- ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
ctx.Data["OpenID"] = oid
userName, _ := ctx.Session.Get("openid_determined_username").(string)
@@ -328,7 +328,7 @@ func RegisterOpenID(ctx *context.Context) {
// RegisterOpenIDPost handles submission of a form to create a new user authenticated via an OpenID URI
func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.SignUpOpenIDForm) {
- if !setting.EnableOpenIDSignUp {
+ if !setting.Service.EnableOpenIDSignUp {
ctx.Error(403)
return
}
@@ -341,7 +341,7 @@ func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.Si
ctx.Data["Title"] = "OpenID signup"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDRegister"] = true
- ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
ctx.Data["OpenID"] = oid