mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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:
1 parent
bcadf26ffc
commit
72f653f5e8
3 files changed
+26
-10
No files matched your search
@@ -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 = []
|
||||
|
||||
|
||||
Reference in new issue
Block a user