Skip to content

Commit 95fddd8

Browse files
duboissjrushlow
authored andcommitted
Add autocomplete html tag to forms
1 parent 2c3009b commit 95fddd8

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/Maker/MakeRegistrationForm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ private function generateFormClass(ClassNameDetails $userClassDetails, Generator
501501
// instead of being set onto the object directly,
502502
// this is read and encoded in the controller
503503
'mapped' => false,
504+
'attr' => ['autocomplete' => 'new-password'],
504505
'constraints' => [
505506
new NotBlank([
506507
'message' => 'Please enter a password',

src/Resources/skeleton/authenticator/login_form.tpl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
2020
<label for="input<?= ucfirst($username_field); ?>"><?= $username_label; ?></label>
21-
<input type="<?= $username_is_email ? 'email' : 'text'; ?>" value="{{ last_username }}" name="<?= $username_field; ?>" id="input<?= ucfirst($username_field); ?>" class="form-control" required autofocus>
21+
<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>
23-
<input type="password" name="password" id="inputPassword" class="form-control" required>
23+
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
2424

2525
<input type="hidden" name="_csrf_token"
2626
value="{{ csrf_token('authenticate') }}"

src/Resources/skeleton/resetPassword/ChangePasswordFormType.tpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
1818
->add('plainPassword', RepeatedType::class, [
1919
'type' => PasswordType::class,
2020
'first_options' => [
21+
'attr' => ['autocomplete' => 'new-password'],
2122
'constraints' => [
2223
new NotBlank([
2324
'message' => 'Please enter a password',
@@ -32,6 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3233
'label' => 'New password',
3334
],
3435
'second_options' => [
36+
'attr' => ['autocomplete' => 'new-password'],
3537
'label' => 'Repeat Password',
3638
],
3739
'invalid_message' => 'The password fields must match.',

src/Resources/skeleton/resetPassword/ResetPasswordRequestFormType.tpl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
1414
{
1515
$builder
1616
->add('<?= $email_field ?>', EmailType::class, [
17+
'attr' => ['autocomplete' => 'email'],
1718
'constraints' => [
1819
new NotBlank([
1920
'message' => 'Please enter your email',

0 commit comments

Comments
 (0)