From d7196a438ca0f3cd1c29a24f212394ce7f465de6 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 11 Mar 2008 01:30:29 +0000 Subject: [PATCH] Merged revisions 50200 via svnmerge from http://svn.silverstripe.com/open/modules/sapphire/branches/2.2.2 ........ r50200 | sminnee | 2008-02-26 14:42:29 +1300 (Tue, 26 Feb 2008) | 1 line Fixed password emailing for edited members ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@50864 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- security/Member.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/security/Member.php b/security/Member.php index 1d5e691d8..b5c66d178 100644 --- a/security/Member.php +++ b/security/Member.php @@ -421,16 +421,7 @@ class Member extends DataObject { * found update this record to merge with that member. */ function onBeforeWrite() { - if(isset($this->changed['Password']) && $this->changed['Password']) { - // Password was changed: encrypt the password according the settings - $encryption_details = Security::encrypt_password($this->Password); - $this->Password = $encryption_details['password']; - $this->Salt = $encryption_details['salt']; - $this->PasswordEncryption = $encryption_details['algorithm']; - - $this->changed['Salt'] = true; - $this->changed['PasswordEncryption'] = true; - } + if($this->SetPassword) $this->Password = $this->SetPassword; if($this->Email) { if($this->ID) { @@ -457,13 +448,22 @@ class Member extends DataObject { } } } - - if($this->SetPassword) $this->Password = $this->SetPassword; if(Director::isLive() && $this->changed['Password'] && $this->record['Password'] && Member::$notify_password_change) $this->sendInfo('changePassword'); + if(isset($this->changed['Password']) && $this->changed['Password']) { + // Password was changed: encrypt the password according the settings + $encryption_details = Security::encrypt_password($this->Password); + $this->Password = $encryption_details['password']; + $this->Salt = $encryption_details['salt']; + $this->PasswordEncryption = $encryption_details['algorithm']; + + $this->changed['Salt'] = true; + $this->changed['PasswordEncryption'] = true; + } + parent::onBeforeWrite(); }