Control password field duplication

Currently password is copied automatically in all the fields.
If application author does not want user to enter password
two times, he may forbid field cloning with 'confirm_input' option.

Targets blueprint: update-password-field

Change-Id: I6d5544e61d76af96a5dc10cec48bc994c83add76
This commit is contained in:
Ekaterina Chernova 2016-01-11 19:39:22 +03:00
parent 6ce981df78
commit 4f2f120f15
3 changed files with 13 additions and 4 deletions

View File

@ -237,6 +237,7 @@ class PasswordField(CharField):
js = ('muranodashboard/js/passwordfield.js',)
def __init__(self, label, *args, **kwargs):
self.confirm_input = kwargs.pop('confirm_input', True)
help_text = kwargs.get('help_text')
if not help_text:
help_text = _('Enter a complex password with at least one letter, \

View File

@ -162,10 +162,10 @@ class UpdatableFieldsForm(forms.Form):
for name, field in six.iteritems(self.fields):
updated_fields[name] = field
if (isinstance(field, fields.PasswordField) and
not field.has_clone and field.original):
updated_fields[
field.get_clone_name(name)] = field.clone_field()
if isinstance(field, fields.PasswordField) and field.confirm_input:
if not field.has_clone and field.original:
updated_fields[
field.get_clone_name(name)] = field.clone_field()
self.fields = updated_fields

View File

@ -0,0 +1,8 @@
---
features:
- Dynamic UI field of type *password* supports ``confirmInput`` parameter
now. It controls whethere password field should be cloned or not.
If application author decided to turn off automatic field cloning, he
should set the new parameter to *false*.