diff --git a/include/simpleplugin/class_attribute.inc b/include/simpleplugin/class_attribute.inc index 202114e4f33b7938ae68c673a6ae4957c8ee784e..a554fcde52c74e0a2c4bafd3de7cb2461b693f2b 100644 --- a/include/simpleplugin/class_attribute.inc +++ b/include/simpleplugin/class_attribute.inc @@ -818,6 +818,7 @@ class StringAttribute extends Attribute { protected $pattern; protected $example; + protected $autocomplete = NULL; /*! \brief The constructor of StringAttribute * @@ -856,6 +857,9 @@ class StringAttribute extends Attribute $js = $this->managedAttributesJS(); $attributes['onChange'] = 'javascript:'.htmlentities($js, ENT_COMPAT, 'UTF-8'); } + if ($this->autocomplete !== NULL) { + $attributes['autocomplete'] = ($this->autocomplete ? 'on' : 'off' ); + } $display = $this->renderInputField('text', $id, $attributes); return $this->renderAcl($display); } @@ -878,6 +882,16 @@ class StringAttribute extends Attribute return msgPool::invalid($this->getLabel(), $this->value, $this->pattern, htmlentities($this->example)); } } + + function setAutocomplete ($bool) + { + $this->autocomplete = $bool; + } + + function getAutocomplete () + { + return $this->autocomplete; + } } class HiddenAttribute extends Attribute @@ -1031,16 +1045,6 @@ class PasswordAttribute extends StringAttribute { protected $autocomplete = FALSE; - function setAutocomplete ($bool) - { - $this->autocomplete = $bool; - } - - function getAutocomplete () - { - return $this->autocomplete; - } - function renderFormInput () { $id = $this->getHtmlId(); @@ -1051,6 +1055,9 @@ class PasswordAttribute extends StringAttribute 'autocomplete' => ($this->autocomplete?'on':'off'), ) ); + if ($this->autocomplete === FALSE) { + $display = '{literal}<input autocomplete="off" value="foolautocompleteworkaround" type="text" style="display:none;"/>{/literal}'.$display; + } return $this->renderAcl($display); } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index dccef87adbc777f524abf6ed9983a421968ec182..eeba0d55b5b54a2e37bc51dabf3bec4bd4e671ee 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -47,11 +47,11 @@ class UserPasswordAttribute extends CompositeAttribute $ldapName.'_pwstorage', TRUE, array_keys($pwd_methods), '', array_values($pwd_methods) ), - new StringAttribute( + new PasswordAttribute( _('Password'), _('Password (Leave empty if you do not wish to change it)'), $ldapName.'_password', $required ), - new StringAttribute( + new PasswordAttribute( _('Password again'), _('Same password as above, to avoid errors'), $ldapName.'_password2', $required ), @@ -385,7 +385,7 @@ class user extends simplePlugin new UserPasswordAttribute( _('Password'), _('Password of the user'), 'userPassword', FALSE - ) + ), ) ), 'homecontact' => array( @@ -441,7 +441,7 @@ class user extends simplePlugin 'manager', FALSE ), ) - ) + ), ); } @@ -450,6 +450,7 @@ class user extends simplePlugin parent::__construct($dn, $object, $parent, $mainTab); $this->attributesAccess['uid']->setUnique('whole'); + $this->attributesAccess['uid']->setAutocomplete(FALSE); $this->attributesAccess['uid']->setDisabled($this->initially_was_account && !$this->is_template); $filename = './plugins/users/images/default.jpg';