Skip to content

Simplify the Stimulus Controller #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Spomky opened this issue May 6, 2025 · 0 comments
Open

Simplify the Stimulus Controller #714

Spomky opened this issue May 6, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Spomky
Copy link
Contributor

Spomky commented May 6, 2025

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 %}
@Spomky Spomky self-assigned this May 6, 2025
@Spomky Spomky added the enhancement New feature or request label May 6, 2025
@Spomky Spomky added this to the 5.3.0 milestone May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant