diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index 60f62c9bb..3367d3fea 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -202,4 +202,21 @@ JS; } return true; } -} \ No newline at end of file + + function saveInto(DataObject $record) { + if(!($this->canBeEmpty && !$this->value)) { + parent::saveInto($record); + } + } + + /** + * Makes a pretty readonly field with some stars in it + */ + function performReadonlyTransformation() { + $stars = '*****'; + + $field = new ReadonlyField($this->name, $this->title ? $this->title : _t('Member.PASSWORD'), $stars); + $field->setForm($this->form); + return $field; + } +} diff --git a/forms/PasswordField.php b/forms/PasswordField.php index 55bbb947c..7cf14696c 100755 --- a/forms/PasswordField.php +++ b/forms/PasswordField.php @@ -47,4 +47,4 @@ class PasswordField extends FormField { } } -?> \ No newline at end of file +?> diff --git a/security/Member.php b/security/Member.php index f9aa6e23b..140cb6e3a 100644 --- a/security/Member.php +++ b/security/Member.php @@ -706,6 +706,9 @@ class Member extends DataObject { public function getCMSFields() { $locale = ($this->Locale) ? $this->Locale : i18n::get_locale(); + $password = new ConfirmedPasswordField('Password', 'Password'); + $password->setCanBeEmpty(true); + $fields = new FieldSet( //new TextField("Salutation", "Title"), new HeaderField(_t('Member.PERSONALDETAILS', "Personal Details", PR_MEDIUM, 'Headline for formfields')), @@ -719,11 +722,7 @@ class Member extends DataObject { i18n::get_existing_translations(), $locale ), - new PasswordField("Password", _t('Member.PASSWORD')) - //new TextareaField("Address","Address"), - //new TextField("JobTitle", "Job Title"), - //new TextField( "Organisation", "Organisation" ), - //new OptionsetField("HTMLEmail","Mail Format", array( 1 => 'HTML', 0 => 'Text only' ) ) + $password ); $this->extend('updateCMSFields', $fields);