stages/identification: improve support for password managers

This commit is contained in:
Jens Langhammer 2020-06-15 18:38:09 +02:00
parent 34c1b3b68b
commit b49d39a685
1 changed files with 10 additions and 2 deletions

View File

@ -39,8 +39,16 @@ class IdentificationForm(forms.Form):
super().__init__(*args, **kwargs)
if self.stage.user_fields == [UserFields.E_MAIL]:
self.fields["uid_field"] = forms.EmailField()
self.fields["uid_field"].label = human_list(
[x.title() for x in self.stage.user_fields]
label = human_list([x.title() for x in self.stage.user_fields])
self.fields["uid_field"].label = label
self.fields["uid_field"].widget.attrs.update(
{
"placeholder": _(label),
"autofocus": "autofocus",
# Autocomplete according to
# https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands
"autocomplete": "username",
}
)
def clean_uid_field(self):