Files
matrix-authentication-service/templates/components/captcha.html
T
Quentin Gliech 62ccbdf6f1 Render the CAPTCHA widgets with React on server-rendered pages
Instead of provider-specific markup and script tags in the head, the
captcha.form() template macro now emits a placeholder element carrying
the CAPTCHA configuration in data attributes, on which a new entrypoint
mounts the React Captcha component. The widget still injects its hidden
response field inside the form, so the server-side verification flow is
unchanged.

This is the first use of inline React components to progressively
enhance server-rendered pages.
2026-08-07 10:28:09 +02:00

22 lines
697 B
HTML

{#
Copyright 2025, 2026 Element Creations Ltd.
Copyright 2024, 2025 New Vector Ltd.
Copyright 2024 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
-#}
{% macro form(class="") -%}
{%- if captcha_config|default(False) -%}
<noscript>
<div class="captcha-noscript">
{{ _("mas.captcha.noscript") }}
</div>
</noscript>
{{ include_asset('src/entrypoints/captcha.tsx') }}
<div class="{{ class }}" data-captcha-service="{{ captcha_config.service }}" data-captcha-site-key="{{ captcha_config.site_key }}"></div>
{%- endif -%}
{% endmacro %}