From 413034f6841524e13f3e658788b43ab42b3ae145 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Thu, 5 Oct 2017 16:34:20 +1300 Subject: [PATCH] Remove psuedo-property SetPassword from Member --- docs/en/04_Changelogs/4.0.0.md | 5 +++-- src/Security/Member.php | 11 ----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md index a9b21db12..30157d20c 100644 --- a/docs/en/04_Changelogs/4.0.0.md +++ b/docs/en/04_Changelogs/4.0.0.md @@ -2507,6 +2507,7 @@ New `TimeField` methods replace `getConfig()` / `setConfig()` * `LoginForm` now has an abstract method `getAuthenticatorName()`. If you have made subclasses of this, you will need to define this method and return a short name describing the login method. - * `MemberLoginForm` has a new constructor argument for the authenticator class, athough tis is usually + * `MemberLoginForm` has a new constructor argument for the authenticator class, although this is usually constructed by `MemberAuthenticator` and won't affect normal use. - * `Authenticator` methods `register` and `unregister` are deprecated in favor of using `Config` + * `Authenticator` methods `register` and `unregister` are deprecated in favour of using `Config` + * Unused `SetPassword` property removed from `Member`. Use `Member::changePassword` or set `Password` directly. diff --git a/src/Security/Member.php b/src/Security/Member.php index e42616ff3..c8039c0b6 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -56,7 +56,6 @@ use SilverStripe\ORM\ValidationResult; * @property int $FailedLoginCount * @property string $DateFormat * @property string $TimeFormat - * @property string $SetPassword Pseudo-DB field for temp storage. Not emitted to DB */ class Member extends DataObject { @@ -858,10 +857,6 @@ class Member extends DataObject */ public function onBeforeWrite() { - if ($this->SetPassword && !$this->passwordChangesToWrite) { - $this->Password = $this->SetPassword; - } - // If a member with the same "unique identifier" already exists with a different ID, don't allow merging. // Note: This does not a full replacement for safeguards in the controller layer (e.g. in a registration form), // but rather a last line of defense against data inconsistencies. @@ -1653,12 +1648,6 @@ class Member extends DataObject } } - if ((!$this->ID && $this->SetPassword) || $this->isChanged('SetPassword')) { - if ($this->SetPassword && $validator) { - $valid->combineAnd($validator->validate($this->SetPassword, $this)); - } - } - return $valid; }