Open
Description
Description
The Stimulus Controller continued growing.
It should be better to split it and simplify the number of options.
This change will permit the controller to be in line with the last security changes.
It could use targets for username/assertion or any other option such as user verification or authenticator selection.
Example
{% extends 'base.html.twig' %}
{% block body %}
{% if error is defined %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form
action="{{ path('app_login') }}"
method="post"
{{ stimulus_controller('@web-auth/login',
{
useBrowserAutofill: true,
requestOptionsUrl: path('webauthn.controller.request.request.login'),
}
) }}
>
<label for="username">Usenrame:</label>
<input
type="text"
id="username"
name="_username"
value="{{ last_username }}"
placeholder="Type your username here"
autocomplete="username webauthn"
{{ stimulus_target('@web-auth/login', 'username') }}
>
<input
type="hidden"
id="assertion"
name="_assertion"
{{ stimulus_target('@web-auth/login', 'assertion') }}
>
<button
id="login"
name="login"
type="submit"
{{ stimulus_action('@web-auth/login', 'login') }}
>login</button>
</form>
{% endblock %}