ENHANCEMENT: Updated Member->getMemberFormFields() to use scaffolding and to be in line with Member->getCMSFields().

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@97401 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew Short 2010-01-21 22:59:19 +00:00 committed by Sam Minnee
parent 712cc578d9
commit bbd9f2a2b5

41
security/Member.php Normal file → Executable file
View File

@ -416,7 +416,6 @@ class Member extends DataObject {
$e->send(); $e->send();
} }
/** /**
* Returns the fields for the member form - used in the registration/profile module. * Returns the fields for the member form - used in the registration/profile module.
* It should return fields that are editable by the admin and the logged-in user. * It should return fields that are editable by the admin and the logged-in user.
@ -424,15 +423,39 @@ class Member extends DataObject {
* @return FieldSet Returns a {@link FieldSet} containing the fields for * @return FieldSet Returns a {@link FieldSet} containing the fields for
* the member form. * the member form.
*/ */
function getMemberFormFields() { public function getMemberFormFields() {
$fields = new FieldSet( $fields = parent::getFrontendFields();
new TextField("FirstName", _t('Member.FIRSTNAME', 'First Name')),
new TextField("Surname", _t('Member.SURNAME', "Surname")),
new TextField("Email", _t('Member.EMAIL', "Email", PR_MEDIUM, 'Noun')),
new TextField("Password", _t('Member.PASSWORD', 'Password'))
);
$this->extend('augmentMemberFormFields', $fields); $fields->replaceField('Password', $password = new ConfirmedPasswordField (
'Password',
$this->fieldLabel('Password'),
null,
null,
(bool) $this->ID
));
$password->setCanBeEmpty(true);
$fields->replaceField('Locale', new DropdownField (
'Locale',
$this->fieldLabel('Locale'),
i18n::get_existing_translations(),
(($this->Locale) ? $this->Locale : i18n::get_locale())
));
$fields->removeByName('RememberLoginToken');
$fields->removeByName('NumVisit');
$fields->removeByName('LastVisited');
$fields->removeByName('Bounced');
$fields->removeByName('AutoLoginHash');
$fields->removeByName('AutoLoginExpired');
$fields->removeByName('PasswordEncryption');
$fields->removeByName('Salt');
$fields->removeByName('PasswordExpiry');
$fields->removeByName('FailedLoginCount');
$fields->removeByName('LastViewed');
$fields->removeByName('LockedOutUntil');
$this->extend('updateMemberFormFields', $fields);
return $fields; return $fields;
} }