mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
Feature/recaptcha v3 plus login (#202)
* [WIP] New GoogleReCAPTCHA code Support for v3 v2-invisible doesn't work yet * Add some notice about recaptchas versions * Lets support only ReCaptcha v3 Too much mess ;) * Fixes
This commit is contained in:
@@ -109,19 +109,9 @@
|
||||
|
||||
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS') }}
|
||||
|
||||
{% if config.recaptcha_enabled %}
|
||||
<tr>
|
||||
<td class="LabelV" style="width: 150px">
|
||||
<span{% if errors.verification[0] is defined %} class="red"{% endif %}>Verification:</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="g-recaptcha" data-sitekey="{{ config.recaptcha_site_key }}" data-theme="{{ config.recaptcha_theme }}"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{% if errors.verification is defined %}
|
||||
<tr><td></td><td><span class="FormFieldError">{{ errors.verification }}</span></td></tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.recaptcha_enabled %}
|
||||
<input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response" />
|
||||
{% endif %}
|
||||
|
||||
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA') }}
|
||||
</tbody>
|
||||
@@ -339,6 +329,10 @@
|
||||
</form>
|
||||
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_FORM') }}
|
||||
<script type="text/javascript" src="tools/check_name.js"></script>
|
||||
{% if config.recaptcha_enabled %}
|
||||
{% set action = 'register' %}
|
||||
{{ include('google_recaptcha.html.twig') }}
|
||||
{% endif %}
|
||||
<style>
|
||||
#SuggestAccountNumber {
|
||||
font-size: 7pt;
|
||||
|
@@ -39,6 +39,9 @@ Please enter your account {{ account|lower }} and your password.<br/><a href="?s
|
||||
<td><input type="checkbox" id="remember_me" name="remember_me" value="true" />
|
||||
<label for="remember_me"> Remember me</label></td>
|
||||
</tr>
|
||||
{% if config.recaptcha_enabled %}
|
||||
<input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response" />
|
||||
{% endif %}
|
||||
{% if error is not null %}
|
||||
<tr><td></td><td><span class="FormFieldError">{{ error }}</span></td></tr>
|
||||
{% endif %}
|
||||
@@ -74,3 +77,7 @@ Please enter your account {{ account|lower }} and your password.<br/><a href="?s
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% if config.recaptcha_enabled %}
|
||||
{% set action = 'login' %}
|
||||
{{ include('google_recaptcha.html.twig') }}
|
||||
{% endif %}
|
||||
|
11
system/templates/google_recaptcha.html.twig
Normal file
11
system/templates/google_recaptcha.html.twig
Normal file
@@ -0,0 +1,11 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
grecaptcha.ready(function() {
|
||||
grecaptcha.execute('{{ config.recaptcha_site_key }}', {action: '{{ action }}'}).then(function(token) {
|
||||
if (token) {
|
||||
document.getElementById('g-recaptcha-response').value = token;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
@@ -17,5 +17,5 @@
|
||||
</div>
|
||||
</noscript>
|
||||
{% if config.recaptcha_enabled %}
|
||||
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||
{% endif %}
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={{ config.recaptcha_site_key }}"></script>
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user