hCaptcha Integration

This commit is contained in:
2024-04-23 14:05:29 +02:00
parent aea20b7a10
commit 51ee723dcb
22 changed files with 275 additions and 145 deletions

View File

@@ -9,8 +9,15 @@
<link rel="stylesheet" href="/css/fontawesome.min.css" nonce="{{ site.csp.nonce }}">
<link rel="stylesheet" href="/css/account.css" nonce="{{ site.csp.nonce }}">
<title>{{ L("account.title")}} - {{ L(view_title) }}</title>
{% if site.recaptcha.enabled %}
<script src="https://www.google.com/recaptcha/api.js?render={{ site.recaptcha.key }}" nonce="{{ site.csp.nonce }}"></script>
{% if site.captcha.enabled %}
<script nonce="{{ site.csp.nonce }}">
window.captchaProvider = {{ site.captcha|json_encode()|raw }};
</script>
{% if site.captcha.provider == 'recaptcha' %}
<script src="https://www.google.com/recaptcha/api.js?render={{ site.captcha.site_key }}" nonce="{{ site.csp.nonce }}"></script>
{% elseif site.captcha.provider == 'hcaptcha' %}
<script src="https://js.hcaptcha.com/1/api.js" nonce="{{ site.csp.nonce }}"></script>
{% endif %}
{% endif %}
{% endblock %}
@@ -30,7 +37,4 @@
</div>
</div>
</div>
{% if site.recaptcha.enabled %}
<input type='hidden' value='{{ site.recaptcha.key }}' id='siteKey' />
{% endif %}
{% endblock %}

View File

@@ -40,6 +40,9 @@
<input type="password" autocomplete='new-password' name='confirmPassword'
id='confirmPassword' class="form-control" placeholder="{{ L('account.password_confirm') }}">
</div>
{% if site.captcha.enabled and site.captcha.provider == 'hcaptcha' %}
<div class="h-captcha mt-2" data-sitekey="{{ site.captcha.site_key }}"></div>
{% endif %}
<div class="input-group mt-3">
<button type="button" class="btn btn-primary" id='btnRegister'>
{{ L('general.submit') }}

View File

@@ -53,6 +53,9 @@
class="form-control" type="email" maxlength="64" />
</div>
</div>
{% if site.captcha.enabled and site.captcha.provider == 'hcaptcha' %}
<div class="h-captcha mt-2" data-sitekey="{{ site.captcha.site_key }}"></div>
{% endif %}
<div class="input-group mt-2">
<button id='btnRequestPasswordReset' class='btn btn-primary'>
{{ L('general.submit') }}