Fixed login CSFR token error

This commit is contained in:
Jan Böhmer
2025-08-04 23:50:25 +02:00
parent c834058678
commit 247fed7d74
4 changed files with 17 additions and 6 deletions

View File

@@ -28,6 +28,11 @@ framework:
#esi: true
#fragments: true
form: { csrf_protection: { token_id: 'submit' } }
csrf_protection:
stateless_token_ids: ['submit', 'authenticate', 'logout']
when@test:
framework:
test: true

View File

@@ -0,0 +1,4 @@
# Enable stateless CSRF protection for forms and logins/logouts
framework:
csrf_protection:
check_header: true

View File

@@ -748,13 +748,16 @@
]
},
"symfony/ux-turbo": {
"version": "2.27",
"version": "2.28",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.20",
"ref": "e4b951d7de760751e170c6d2e3b565cf9ed5182f"
}
"ref": "287f7c6eb6e9b65e422d34c00795b360a787380b"
},
"files": [
"config/packages/ux_turbo.yaml"
]
},
"symfony/validator": {
"version": "7.3",

View File

@@ -22,8 +22,7 @@
{% block card_content %}
<form action="{{ path('login') }}" method="post" data-turbo="false" class="form-horizontal">
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}">
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
<input type="hidden" name="_target_path" value="{{ app.request.query.get('_target_path') }}" />
@@ -72,4 +71,4 @@
{% if allow_email_pw_reset %}
<a class="offset-sm-2" href="{{ path('pw_reset_request') }}">{% trans %}pw_reset.password_forget{% endtrans %}</a>
{% endif %}
{% endblock %}
{% endblock %}