mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Tidied up code formatting for MemberLoginForm->forgotPassword() to be clearer
ENHANCEMENT Added a message if no email address was specified, for user feedback purposes on MemberLoginForm->forgotPassword() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64406 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
85bcedf9e6
commit
0d8e5708c0
@ -188,26 +188,36 @@ class MemberLoginForm extends LoginForm {
|
||||
*/
|
||||
function forgotPassword($data) {
|
||||
$SQL_data = Convert::raw2sql($data);
|
||||
$SQL_email = $SQL_data['Email'];
|
||||
$member = DataObject::get_one('Member', "Email = '{$SQL_email}'");
|
||||
|
||||
if(($data['Email']) && ($member = DataObject::get_one("Member",
|
||||
"Member.Email = '$SQL_data[Email]'"))) {
|
||||
|
||||
if($member) {
|
||||
$member->generateAutologinHash();
|
||||
|
||||
$member->sendInfo('forgotPassword', array('PasswordResetLink' =>
|
||||
Security::getPasswordResetLink($member->AutoLoginHash)));
|
||||
$member->sendInfo(
|
||||
'forgotPassword',
|
||||
array(
|
||||
'PasswordResetLink' => Security::getPasswordResetLink($member->AutoLoginHash)
|
||||
)
|
||||
);
|
||||
|
||||
Director::redirect('Security/passwordsent/' . urlencode($data['Email']));
|
||||
|
||||
} else if($data['Email']) {
|
||||
} elseif($data['Email']) {
|
||||
$this->sessionMessage(
|
||||
_t('Member.ERRORSIGNUP', "Sorry, but I don't recognise the e-mail address. Maybe you need " .
|
||||
"to sign up, or perhaps you used another e-mail address?"),
|
||||
"bad");
|
||||
_t('Member.ERRORSIGNUP', 'Sorry, but I don\'t recognise the e-mail address. Maybe you need ' .
|
||||
'to sign up, or perhaps you used another e-mail address?'
|
||||
),
|
||||
'bad'
|
||||
);
|
||||
|
||||
Director::redirectBack();
|
||||
|
||||
} else {
|
||||
Director::redirect("Security/lostpassword");
|
||||
$this->sessionMessage(
|
||||
_t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.'),
|
||||
'bad'
|
||||
);
|
||||
|
||||
Director::redirect('Security/lostpassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user