mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Add simple captcha
This commit is contained in:
parent
3612c1747e
commit
c0719fdeaa
@ -105,11 +105,16 @@ class RegisterForm(FlaskForm):
|
||||
Regexp("^[a-zA-Z0-9._-]+$", message="Only a-zA-Z0-9._ allowed")])
|
||||
email = StringField("Email", [InputRequired(), Email()])
|
||||
password = PasswordField("Password", [InputRequired(), Length(6, 100)])
|
||||
agree = BooleanField("I agree", [Required()])
|
||||
question = StringField("What is the result of the above calculation?", [InputRequired()])
|
||||
agree = BooleanField("I agree", [DataRequired()])
|
||||
submit = SubmitField("Register")
|
||||
|
||||
|
||||
def handle_register(form):
|
||||
if form.question.data.strip().lower() != "19":
|
||||
flash("Incorrect captcha answer", "danger")
|
||||
return
|
||||
|
||||
user_by_name = User.query.filter(or_(
|
||||
User.username == form.username.data,
|
||||
User.username == form.display_name.data,
|
||||
@ -168,7 +173,8 @@ def register():
|
||||
if ret:
|
||||
return ret
|
||||
|
||||
return render_template("users/register.html", form=form, suggested_password=genphrase(entropy=52, wordset="bip39"))
|
||||
return render_template("users/register.html", form=form,
|
||||
suggested_password=genphrase(entropy=52, wordset="bip39"))
|
||||
|
||||
|
||||
class ForgotPasswordForm(FlaskForm):
|
||||
|
BIN
app/public/static/puzzle.png
Normal file
BIN
app/public/static/puzzle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -32,6 +32,11 @@ Register
|
||||
<code>{{ suggested_password }}</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img src="/static/puzzle.png" />
|
||||
</p>
|
||||
{{ render_field(form.question, hint=_("Please prove that you are human")) }}
|
||||
|
||||
{% set label %}
|
||||
{{ _("I agree to the ") }}
|
||||
<a href="{{ url_for('flatpage', path='privacy_policy') }} ">
|
||||
|
Loading…
Reference in New Issue
Block a user