From a8eeed91fd58cbfa157c2ec3838d76ccf2c32985 Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Thu, 14 Aug 2014 19:01:22 +0100 Subject: [PATCH] Allow forms to disable autofill in all browsers New variable added to form to specify whether it should autofill or not. This updates the modal forms autocomplete attribute. Hidden fields are required because Chromium v34+ based browsers ignore the autocomplete=off form attribute, so the hidden fields catch autofill data. Any form without self.no_autocomplete = True will just act like before. Conflicts: horizon/templates/horizon/common/_modal_form.html openstack_dashboard/dashboards/admin/users/forms.py Change-Id: Ibb1722023eea8f57312e1133939d1f75cd909467 Closes-Bug: 1352459 (cherry picked from commit e79af0ac1e273db86f0034898cb05720df34aa35) --- horizon/templates/horizon/common/_modal_form.html | 12 ++++++++++-- openstack_dashboard/dashboards/admin/users/forms.py | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/horizon/templates/horizon/common/_modal_form.html b/horizon/templates/horizon/common/_modal_form.html index 812b613b7f..6702e2a062 100644 --- a/horizon/templates/horizon/common/_modal_form.html +++ b/horizon/templates/horizon/common/_modal_form.html @@ -12,12 +12,20 @@
{% csrf_token %}
{% block modal-js %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/users/forms.py b/openstack_dashboard/dashboards/admin/users/forms.py index 722d1686f3..3c868454a1 100644 --- a/openstack_dashboard/dashboards/admin/users/forms.py +++ b/openstack_dashboard/dashboards/admin/users/forms.py @@ -94,6 +94,7 @@ class CreateUserForm(BaseUserForm): project = forms.DynamicChoiceField(label=_("Primary Project"), add_item_link=ADD_PROJECT_URL) role_id = forms.ChoiceField(label=_("Role")) + no_autocomplete = True def __init__(self, *args, **kwargs): roles = kwargs.pop('roles') @@ -171,6 +172,7 @@ class UpdateUserForm(BaseUserForm): widget=forms.PasswordInput(render_value=False), required=False) project = forms.ChoiceField(label=_("Primary Project")) + no_autocomplete = True def __init__(self, request, *args, **kwargs): super(UpdateUserForm, self).__init__(request, *args, **kwargs)