Refactor login form to include password input conditionally

This removes the username login box when only providers are chosen
This commit is contained in:
Gordnho authored and GitHub committed 2026-04-03 14:50:26 +02:00
1 parent 0f4ce9eccb
commit 732dc7970c
1 file changed
+10 -10
+10 -10
View File
@@ -41,7 +41,8 @@ Please see LICENSE files in the repository root for full details.
{% endif %}
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
{% if features.password_login %}
{% if features.login_with_email_allowed %}
{% call(f) field.field(label=_("mas.login.username_or_email"), name="username", form_state=form) %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="off" required />
@@ -51,16 +52,15 @@ Please see LICENSE files in the repository root for full details.
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="off" required />
{% endcall %}
{% endif %}
{% if features.password_login %}
{% call(f) field.field(label=_("common.password"), name="password", form_state=form) %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="password" autocomplete="password" required />
{% endcall %}
{% if features.account_recovery %}
{{ button.link_text(text=_("mas.login.forgot_password"), href="/recover", class="self-center") }}
{% endif %}
{% call(f) field.field(label=_("common.password"), name="password", form_state=form) %}
<input {{ field.attributes(f) }} class="cpd-text-control" type="password" autocomplete="password" required />
{% endcall %}
{% if features.account_recovery %}
{{ button.link_text(text=_("mas.login.forgot_password"), href="/recover", class="self-center") }}
{% endif %}
{% endif %}
</div>
<div class="cpd-form-root">