FIX: Disable autocomplete on ConfirmedPasswordField instances.

This commit is contained in:
Will Rossiter 2013-05-10 20:32:59 +12:00
parent 09fcdb8c31
commit 94d6b1ccff
2 changed files with 9 additions and 1 deletions

View File

@ -95,6 +95,12 @@ class ConfirmedPasswordField extends FormField {
if($showOnClick) { if($showOnClick) {
$this->children->push(new HiddenField("{$name}[_PasswordFieldVisible]")); $this->children->push(new HiddenField("{$name}[_PasswordFieldVisible]"));
} }
// disable auto complete
foreach($this->children as $child) {
$child->setAttribute('autocomplete', 'off');
}
$this->showOnClick = $showOnClick; $this->showOnClick = $showOnClick;
// we have labels for the subfields // we have labels for the subfields
@ -136,11 +142,13 @@ class ConfirmedPasswordField extends FormField {
foreach($this->children as $field) { foreach($this->children as $field) {
$field->setDisabled($this->isDisabled()); $field->setDisabled($this->isDisabled());
$field->setReadonly($this->isReadonly()); $field->setReadonly($this->isReadonly());
if(count($this->attributes)) { if(count($this->attributes)) {
foreach($this->attributes as $name => $value) { foreach($this->attributes as $name => $value) {
$field->setAttribute($name, $value); $field->setAttribute($name, $value);
} }
} }
$content .= $field->FieldHolder(); $content .= $field->FieldHolder();
} }

View File

@ -1,5 +1,5 @@
(function ($) { (function ($) {
$('.confirmedpassword .showOnClick a').live('click', function () { $(document).on('click', '.confirmedpassword .showOnClick a', function () {
var $container = $('.showOnClickContainer', $(this).parent()); var $container = $('.showOnClickContainer', $(this).parent());
$container.toggle('fast', function() { $container.toggle('fast', function() {