Captcha for searches

This commit is contained in:
Simon
2018-08-10 12:46:40 -04:00
parent c94cf5b313
commit c29af180c5
4 changed files with 100 additions and 66 deletions

View File

@@ -9,7 +9,7 @@
<div class="card">
<div class="card-header">Search</div>
<div class="card-body">
<form action="/search">
<form action="/search" id="sfrm">
<div class="form-row">
@@ -92,7 +92,14 @@
{# Search button #}
<div class="form-group col-md-7">
<input class="btn btn-primary btn-shadow" type="submit" value="Search" style="float: right">
{% if show_captcha %}
<script>function f(token) {document.getElementById("sfrm").submit();}</script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<button class="g-recaptcha btn btn-primary btn-shadow" data-sitekey="6LcCXWkUAAAAAJo2NR9_m09Obn5YmDrI97sGrr2f" data-callback="f" style="float: right">Search</button>
{% else %}
<input class="btn btn-primary btn-shadow" type="submit" value="Search" style="float: right">
{% endif %}
</div>
</div>