Fix template lookup errors on the login page

This patch makes sure that all the variables and attributes that the
login page templates use are always defined, to avoid annoying lookup
errors in the logs.

There is still an error about request.COOKIES.logout_reason because
I'm not entirely sure how to best handle that one.

Change-Id: I692ea70bc09b819b39587f5bd6cb4e729731754f
This commit is contained in:
Radomir Dopieralski 2020-05-18 15:59:51 +02:00
parent ed11d5bb2f
commit 6ffeb3caba
2 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,8 @@ class Login(django_auth_forms.AuthenticationForm):
class for added security features.
"""
use_required_attribute = False
required_css_class = "required"
warnings = []
region = forms.ChoiceField(label=_("Region"), required=False)
username = forms.CharField(
label=_("User Name"),

View File

@ -106,6 +106,11 @@ def login(request):
'redirect_field_name': auth.REDIRECT_FIELD_NAME,
'csrf_failure': request.GET.get('csrf_failure'),
'show_sso_opts': settings.WEBSSO_ENABLED and len(choices) > 1,
'classes': {
'value': '',
'single_value': '',
'label': '',
},
}
if request.is_ajax():