fix(csrf): supprimer prevent_initial_call=True sur _fill_csrf_inputs

Avec prevent_initial_call=True, le callback ne s'exécutait pas lors de
la chaîne initiale (_generate_csrf_token → csrf-token), laissant le champ
csrf_token vide au premier chargement direct de /connexion → erreur 400.

Ajoute des tests comportementaux avec CSRF activé (comme en production) et
un test architectural qui vérifie que le callback reste appelable initialement.
Corrige aussi les assertions de redirection post-login (/compte/abonnement).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-06-29 15:46:30 +02:00
parent f8112274cf
commit 8cd5bfe821
4 changed files with 91 additions and 3 deletions
-1
View File
@@ -297,7 +297,6 @@ def _generate_csrf_token(*_):
@callback(
Output({"type": "csrf-input", "index": ALL}, "value"),
Input("csrf-token", "data"),
prevent_initial_call=True,
)
def _fill_csrf_inputs(token):
return [token] * len(ctx.outputs_list)