8000 Generate data-controller="csrf-protection" on CSRF fields · symfony/maker-bundle@b13f0fb · GitHub
[go: up one dir, main page]

Skip to content

Commit b13f0fb

Browse files
Generate data-controller="csrf-protection" on CSRF fields
1 parent 0624f13 commit b13f0fb

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

templates/authenticator/login_form.tpl.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
<input type="<?= $username_is_email ? 'email' : 'text'; ?>" value="{{ last_username }}" name="<?= $username_field; ?>" id="input<?= ucfirst($username_field); ?>" class="form-control" autocomplete="<?= $username_is_email ? 'email' : 'username'; ?>" required autofocus>
2222
<label for="inputPassword">Password</label>
2323
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
24-
25-
<input type="hidden" name="_csrf_token"
26-
value="{{ csrf_token('authenticate') }}"
27-
>
24+
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
2825
<?php if($support_remember_me && !$always_remember_me): ?>
2926

3027
<div class="checkbox mb-3">

templates/security/formLogin/login_form.tpl.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
<input type="<?= $username_is_email ? 'email' : 'text'; ?>" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="<?= $username_is_email ? 'email' : 'username'; ?>" required autofocus>
2222
<label for="password">Password</label>
2323
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
24-
25-
<input type="hidden" name="_csrf_token"
26-
value="{{ csrf_token('authenticate') }}"
27-
>
24+
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
2825

2926
{#
3027
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.

tests/fixtures/security/make-form-login/expected/login.html.twig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
2020
<label for="password">Password</label>
2121
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
22-
23-
<input type="hidden" name="_csrf_token"
24-
value="{{ csrf_token('authenticate') }}"
25-
>
22+
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
2623

2724
{#
2825
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.

tests/fixtures/security/make-form-login/expected/login_no_logout.html.twig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
1414
<label for="password">Password</label>
1515
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
16-
17-
<input type="hidden" name="_csrf_token"
18-
value="{{ csrf_token('authenticate') }}"
19-
>
16+
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
2017

2118
{#
2219
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.

0 commit comments

Comments
 (0)
0