sso, users: Turn off autocapitalization on the username field

Set autocapitalization='none' and autocomplete='username' on the username field.
Latest Django version uses those attributes by default on the username field.

Closes #1207

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa authored and James Valleroy committed 2020-02-09 11:17:47 -05:00
1 parent bcadf26ffc
commit 72f653f5e8
3 files changed
+26 -10

No files matched your search

+10 -2
View File
@@ -125,7 +125,11 @@ class CreateUserForm(ValidNewUsernameCheckMixin,
self.request = request
super(CreateUserForm, self).__init__(*args, **kwargs)
self.fields['groups'].choices = get_group_choices()
self.fields['username'].widget.attrs.update({'autofocus': 'autofocus'})
self.fields['username'].widget.attrs.update({
'autofocus': 'autofocus',
'autocapitalize': 'none',
'autocomplete': 'username'
})
def save(self, commit=True):
"""Save the user model and create LDAP user if required."""
@@ -194,7 +198,11 @@ class UserUpdateForm(ValidNewUsernameCheckMixin,
self.username = username
super(UserUpdateForm, self).__init__(*args, **kwargs)
self.is_last_admin_user = get_last_admin_user() == self.username
self.fields['username'].widget.attrs.update({'autofocus': 'autofocus'})
self.fields['username'].widget.attrs.update({
'autofocus': 'autofocus',
'autocapitalize': 'none',
'autocomplete': 'username'
})
choices = []