1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00
Files
2024-05-15 09:38:10 +02:00

50 lines
1.9 KiB
HTML

{#
Copyright 2024 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}
{% macro form(class="") -%}
{%- if captcha|default(False) -%}
<noscript>
<div class="captcha-noscript">
{{ _("mas.captcha.noscript") }}
</div>
</noscript>
{%- if captcha.service == "recaptcha_v2" -%}
<div class="g-recaptcha {{ class }}" data-sitekey="{{ captcha.site_key }}"></div>
{%- elif captcha.service == "cloudflare_turnstile" -%}
<div class="cf-turnstile {{ class }}" data-sitekey="{{ captcha.site_key }}"></div>
{%- elif captcha.service == "hcaptcha" -%}
<div class="h-captcha {{ class }}" data-sitekey="{{ captcha.site_key }}"></div>
{%- else -%}
{{ throw(message="Invalid captcha service setup") }}
{%- endif %}
{%- endif -%}
{% endmacro %}
{% macro head() -%}
{%- if captcha|default(False) -%}
{%- if captcha.service == "recaptcha_v2" -%}
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
{%- elif captcha.service == "cloudflare_turnstile" -%}
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
{%- elif captcha.service == "hcaptcha" -%}
<script src="https://js.hcaptcha.com/1/api.js?recaptchacompat=off" async defer></script>
{%- else -%}
{{ throw(message="Invalid captcha service setup") }}
{%- endif %}
{%- endif -%}
{%- endmacro %}