0001-prefill-username-when-authenticated-28853.patch
src/authentic2/authenticators.py | ||
---|---|---|
38 | 38 |
is_post = request.method == 'POST' and self.submit_name in request.POST |
39 | 39 |
data = request.POST if is_post else None |
40 | 40 |
form = authentication_forms.AuthenticationForm(request=request, data=data) |
41 |
if request.user.is_authenticated(): |
|
42 |
form.initial['username'] = request.user.username or request.user.email |
|
43 |
form.fields['username'].widget.attrs.pop('autofocus', None) |
|
44 |
form.fields['password'].widget.attrs['autofocus'] = 'autofocus' |
|
41 | 45 |
if app_settings.A2_ACCEPT_EMAIL_AUTHENTICATION: |
42 | 46 |
form.fields['username'].label = _('Username or email') |
43 | 47 |
if app_settings.A2_USERNAME_LABEL: |
44 |
- |