summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColleen Murphy <colleen@gazlene.net>2017-11-02 18:19:09 +0100
committerColleen Murphy <colleen@gazlene.net>2017-11-02 18:19:09 +0100
commit1fa9ae26cc6006f8ee94fabddb7fea171adee55d (patch)
treeab0ef4f8f02ebd0b612644855aa864fa721a2207
parent3d5a5aadfd145fe880b45c437ef4b120d19925e2 (diff)
Don't add required attribute to html form fields
In Django 1.10 a new Form property was introduced, defaulting to True, which enabled HTML form validation for fields marked "required" in Django. This changed old behavior, which was that required fields were only validated server-side. This patch restores old behavior by setting use_required_attribute to False for the inherited AuthenticationForm. This problem arose because when WebSSO is enabled and a non-keystone-credentials authentication method is selected from the dropdown list, the now-hidden username and password fields are still marked "required" and still validated client-side, even though they are invisible to the user and cannot be filled in. It would be nice to fix the javascript to properly turn the "required" attribute on or off depending on what authentication method is selected and whether the "required" fields are even visible, but for now this just restores the behavior we had before Djanto 1.10. Change-Id: I3e798a2288d9c33396b40a86b07ea8c163d3b525 Closes-bug: #1703109
Notes
Notes (review): Code-Review+2: Rob Cresswell <robert.cresswell@outlook.com> Code-Review+1: Ivan Kolodyazhny <e0ne@e0ne.info> Code-Review+2: Akihiro Motoki <amotoki@gmail.com> Workflow+1: Akihiro Motoki <amotoki@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 09 Nov 2017 17:36:21 +0000 Reviewed-on: https://review.openstack.org/517382 Project: openstack/django_openstack_auth Branch: refs/heads/master
-rw-r--r--openstack_auth/forms.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/openstack_auth/forms.py b/openstack_auth/forms.py
index c7d0c51..107fb19 100644
--- a/openstack_auth/forms.py
+++ b/openstack_auth/forms.py
@@ -47,6 +47,7 @@ class Login(django_auth_forms.AuthenticationForm):
47 Inherits from the base ``django.contrib.auth.forms.AuthenticationForm`` 47 Inherits from the base ``django.contrib.auth.forms.AuthenticationForm``
48 class for added security features. 48 class for added security features.
49 """ 49 """
50 use_required_attribute = False
50 region = forms.ChoiceField(label=_("Region"), required=False) 51 region = forms.ChoiceField(label=_("Region"), required=False)
51 username = forms.CharField( 52 username = forms.CharField(
52 label=_("User Name"), 53 label=_("User Name"),