Skip to content

Commit 6fa0f91

Browse files
committed
Use decent autocomplete attributes
1 parent f4fab8c commit 6fa0f91

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/Form/User/ForgotPasswordType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2424
EmailType::class,
2525
[
2626
'label' => 'Email',
27+
'attr' => [
28+
'tabindex' => 1,
29+
'autocomplete' => 'username',
30+
],
2731
]
2832
);
2933
}

src/Form/User/LoginType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2525
'label' => 'Email',
2626
'attr' => [
2727
'tabindex' => 1,
28+
'autocomplete' => 'username',
2829
],
2930
]
3031
)
@@ -35,6 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3536
'label' => 'Password',
3637
'attr' => [
3738
'tabindex' => 2,
39+
'autocomplete' => 'current-password',
3840
],
3941
]
4042
);

src/Form/User/RepeatedPasswordStrengthType.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,24 @@ final class RepeatedPasswordStrengthType extends AbstractType
1616
public function configureOptions(OptionsResolver $resolver): void
1717
{
1818
$resolver->setDefault('type', PasswordType::class);
19-
$resolver->setDefault('first_options', ['label' => 'Password']);
20-
$resolver->setDefault('second_options', ['label' => 'Confirm password']);
19+
$resolver->setDefault(
20+
'first_options',
21+
[
22+
'label' => 'Password',
23+
'attr' => [
24+
'autocomplete' => 'new-password',
25+
],
26+
]
27+
);
28+
$resolver->setDefault(
29+
'second_options',
30+
[
31+
'label' => 'Confirm password',
32+
'attr' => [
33+
'autocomplete' => 'new-password',
34+
],
35+
]
36+
);
2137
}
2238

2339
public function getParent(): string

0 commit comments

Comments
 (0)