Add support for recaptcha upon signup

master
kaiyou 7 years ago
parent e02e47c48e
commit 3ef4e1f6b7

@ -52,6 +52,8 @@ default_config = {
'WEBSITE': 'https://mailu.io', 'WEBSITE': 'https://mailu.io',
'WEB_ADMIN': '/admin', 'WEB_ADMIN': '/admin',
'WEB_WEBMAIL': '/webmail', 'WEB_WEBMAIL': '/webmail',
'RECAPTCHA_PUBLIC_KEY': '',
'RECAPTCHA_PRIVATE_KEY': '',
# Advanced settings # Advanced settings
'PASSWORD_SCHEME': 'SHA512-CRYPT', 'PASSWORD_SCHEME': 'SHA512-CRYPT',
# Host settings # Host settings

@ -79,6 +79,7 @@ class UserSignupForm(flask_wtf.FlaskForm):
localpart = fields.StringField(_('Email address'), [validators.DataRequired(), validators.Regexp("^[a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+$")]) localpart = fields.StringField(_('Email address'), [validators.DataRequired(), validators.Regexp("^[a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+$")])
pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) pw = fields.PasswordField(_('Password'), [validators.DataRequired()])
pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')]) pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')])
captcha = flask_wtf.RecaptchaField()
submit = fields.SubmitField(_('Sign up')) submit = fields.SubmitField(_('Sign up'))

@ -14,6 +14,7 @@
{% call macros.box() %} {% call macros.box() %}
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }} {{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
{{ macros.form_fields((form.pw, form.pw2)) }} {{ macros.form_fields((form.pw, form.pw2)) }}
{{ macros.form_field(form.captcha) }}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
{% endcall %} {% endcall %}
</form> </form>

@ -103,6 +103,10 @@ SITENAME=Mailu
# Linked Website URL # Linked Website URL
WEBSITE=https://mailu.io WEBSITE=https://mailu.io
# Registration reCaptcha settings (warning, this has some privacy impact)
# RECAPTCHA_PUBLIC_KEY=
# RECAPTCHA_PRIVATE_KEY=
################################### ###################################
# Advanced settings # Advanced settings
################################### ###################################

Loading…
Cancel
Save