summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2017-03-17 17:40:39 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-03-20 08:58:00 +0100
commit97ee88975a43b8d69bd2abfcce0af10fadc172fa (patch)
treea54eb6e929ebba8d20b04532fa263cf055f65e2f /routers/user
parentf00a4c8078a74a6cdf64e902b7c8952e3bf4c18c (diff)
downloadgitea-97ee88975a43b8d69bd2abfcce0af10fadc172fa.tar.gz
gitea-97ee88975a43b8d69bd2abfcce0af10fadc172fa.zip
Add captcha support to OpenID based signup
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/auth_openid.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/user/auth_openid.go b/routers/user/auth_openid.go
index ebcfa76652..19c1548399 100644
--- a/routers/user/auth_openid.go
+++ b/routers/user/auth_openid.go
@@ -15,6 +15,8 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+
+ "github.com/go-macaron/captcha"
)
const (
@@ -310,6 +312,7 @@ func RegisterOpenID(ctx *context.Context) {
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDRegister"] = true
ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
ctx.Data["OpenID"] = oid
userName, _ := ctx.Session.Get("openid_determined_username").(string)
if userName != "" {
@@ -323,7 +326,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, form auth.SignUpOpenIDForm) {
+func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.SignUpOpenIDForm) {
if ! setting.EnableOpenIDSignUp {
ctx.Error(403)
return
@@ -338,16 +341,14 @@ func RegisterOpenIDPost(ctx *context.Context, form auth.SignUpOpenIDForm) {
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsOpenIDRegister"] = true
ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp
+ ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
ctx.Data["OpenID"] = oid
-/*
- // TODO: handle captcha ?
if setting.Service.EnableCaptcha && !cpt.VerifyReq(ctx.Req) {
ctx.Data["Err_Captcha"] = true
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), tplSignUpOID, &form)
return
}
-*/
len := setting.MinPasswordLength
if len < 256 { len = 256 }