From e19b70fc71dab0b1bc25f0fe6cb34fccfd0cac57 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Wed, 6 Jul 2022 19:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=E5=8A=A0=E5=90=8C?= =?UTF-8?q?=E6=84=8F=E7=9B=B8=E5=85=B3=E5=8D=8F=E8=AE=AE=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/auth/user_form.go | 1 + options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 3 ++- routers/user/auth.go | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) 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,