mirror of
https://github.com/ProjectSynthoria/SynthoriaArchive.git
synced 2025-03-12 23:36:54 +02:00
commenting: show CAPTCHA to new accounts (#443)
Basically re-use the upload CAPTCHA code to also do this for comments.
This commit is contained in:
parent
f8a287caa0
commit
0285c12264
2 changed files with 29 additions and 2 deletions
|
@ -205,6 +205,8 @@ class CommentForm(FlaskForm):
|
||||||
DataRequired(message='Comment must not be empty.')
|
DataRequired(message='Comment must not be empty.')
|
||||||
])
|
])
|
||||||
|
|
||||||
|
recaptcha = RecaptchaField(validators=[upload_recaptcha_validator_shim])
|
||||||
|
|
||||||
|
|
||||||
class InlineButtonWidget(object):
|
class InlineButtonWidget(object):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -193,8 +193,33 @@
|
||||||
{% if comment_form %}
|
{% if comment_form %}
|
||||||
<form class="comment-box" method="POST">
|
<form class="comment-box" method="POST">
|
||||||
{{ comment_form.csrf_token }}
|
{{ comment_form.csrf_token }}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
{{ render_field(comment_form.comment, class_='form-control') }}
|
{{ render_field(comment_form.comment, class_='form-control') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if config.USE_RECAPTCHA and g.user.age < config['ACCOUNT_RECAPTCHA_AGE'] %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
{% if comment_form.recaptcha.errors %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<p><strong>CAPTCHA error:</strong></p>
|
||||||
|
<ul>
|
||||||
|
{% for error in comment_form.recaptcha.errors %}
|
||||||
|
<li>{{ error }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{{ comment_form.recaptcha }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
<input type="submit" value="Submit" class="btn btn-success btn-sm">
|
<input type="submit" value="Submit" class="btn btn-success btn-sm">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue