Skip to content

Commit 1312099

Browse files
JammyClarkieOskarStark
authored andcommitted
Update security.rst
If this form is submitted with an empty username or password, a 400 error will be thrown in a new page: The key "_password" must be a non-empty string. By adding "required" the user will instead get a more helpful "Please fill in this field." error on screen next to the appropriate box which is a much better experience.
1 parent 3dc8ba5 commit 1312099

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,10 @@ Finally, create or update the template:
833833

834834
<form action="{{ path('app_login') }}" method="post">
835835
<label for="username">Email:</label>
836-
<input type="text" id="username" name="_username" value="{{ last_username }}">
836+
<input type="text" id="username" name="_username" value="{{ last_username }}" required>
837837

838838
<label for="password">Password:</label>
839-
<input type="password" id="password" name="_password">
839+
<input type="password" id="password" name="_password" required>
840840

841841
{# If you want to control the URL the user is redirected to on success
842842
<input type="hidden" name="_target_path" value="/account"> #}

0 commit comments

Comments
 (0)