Domain enabled login screen needs focus on Domain field

After you enable v3 support, you will see a Domain field on
the login screen. However, the focus is still on the Username
field. It should be on the first field which is Domain.

Change-Id: I9d74a4f727d91e0db03988c00e5bc94979966e3b
Closes-bug: #1396812
This commit is contained in:
liyingjun 2014-11-26 21:22:56 +08:00
parent 7c5f759473
commit 5bc597c0ce
1 changed files with 5 additions and 2 deletions

View File

@ -58,8 +58,11 @@ class Login(django_auth_forms.AuthenticationForm):
if getattr(settings,
'OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT',
False):
self.fields['domain'] = forms.CharField(label=_("Domain"),
required=True)
self.fields['domain'] = forms.CharField(
label=_("Domain"),
required=True,
widget=forms.TextInput(attrs={"autofocus": "autofocus"}))
self.fields['username'].widget = forms.widgets.TextInput()
self.fields.keyOrder = ['domain', 'username', 'password', 'region']
self.fields['region'].choices = self.get_region_choices()
if len(self.fields['region'].choices) == 1: