diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index 8575e7344..130586a5a 100755 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -85,6 +85,7 @@ type RegisterForm struct { VerifyCode string `binding:"MaxSize(10)"` Retype string GRecaptchaResponse string `form:"g-recaptcha-response"` + Agree bool } // Validate valideates the fields diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c4f1a4648..2efaafdc9 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -33,6 +33,7 @@ twofa = Two-Factor Authentication twofa_scratch = Two-Factor Scratch Code passcode = Passcode use_and_privacy_agree = I have read and agree to the use agreement and privacy agreement +sign_up_agree_tips = should agree to the use agreement and privacy agreement! u2f_insert_key = Insert your security key u2f_sign_in = Press the button on your security key. If your security key has no button, re-insert it. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 016db899e..fe91aaed3 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -32,7 +32,8 @@ captcha=验证码 twofa=两步验证 twofa_scratch=两步验证口令 passcode=验证码 -use_and_privacy_agree = 我已阅读并同意使用协议隐私协议 +use_and_privacy_agree = 我已阅读并同意 使用协议隐私协议 +sign_up_agree_tips = 注册时需同意使用协议和隐私协议 u2f_insert_key=插入安全密钥 u2f_sign_in=按下安全密钥上的按钮。如果安全密钥没有按钮,请重新插入。 diff --git a/routers/user/auth.go b/routers/user/auth.go index 572cbd2f3..95f5a3cb1 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -1315,6 +1315,11 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo return } } + + if !form.Agree { + ctx.RenderWithErr(ctx.Tr("sign_up_agree_tips"), tplSignUp, &form) + return + } u := &models.User{ Name: form.UserName,