mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
fixed bugs introduced during merging
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42068 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
74f2009f6c
commit
8c3a21baa4
@ -33,6 +33,7 @@ function getTempFolder() {
|
||||
}
|
||||
|
||||
return $ssTmp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -332,66 +332,6 @@ class Security extends Controller {
|
||||
return self::Link('changepassword') . "?h=$autoLoginHash";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the "change password" page
|
||||
*
|
||||
* @return string Returns the "change password" page as HTML code.
|
||||
*/
|
||||
public function changepassword() {
|
||||
$tmpPage = new Page();
|
||||
$tmpPage->Title = 'Change your password';
|
||||
$tmpPage->URLSegment = 'Security';
|
||||
$controller = new Page_Controller($tmpPage);
|
||||
|
||||
if(isset($_REQUEST['h']) && Member::autoLoginHash($_REQUEST['h'])) {
|
||||
// The auto login hash is valid, store it for the change password form
|
||||
Session::set('AutoLoginHash', $_REQUEST['h']);
|
||||
|
||||
$customisedController = $controller->customise(array(
|
||||
'Content' =>
|
||||
'<p>Please enter a new password.</p>',
|
||||
'Form' => $this->ChangePasswordForm(),
|
||||
));
|
||||
|
||||
} elseif(Member::currentUser()) {
|
||||
// let a logged in user change his password
|
||||
$customisedController = $controller->customise(array(
|
||||
'Content' => '<p>You can change your password below.</p>',
|
||||
'Form' => $this->ChangePasswordForm()));
|
||||
|
||||
} else {
|
||||
// show an error message if the auto login hash is invalid and the
|
||||
// user is not logged in
|
||||
if(isset($_REQUEST['h'])) {
|
||||
$customisedController = $controller->customise(array('Content' =>
|
||||
"<p>The password reset link is invalid or expired.</p>\n" .
|
||||
'<p>You can request a new one <a href="' .
|
||||
$this->Link('lostpassword') .
|
||||
'">here</a> or change your password after you <a href="' .
|
||||
$this->link('login') . '">logged in</a>.</p>'));
|
||||
} else {
|
||||
self::permissionFailure($this, 'You must be logged in in order to change your password!');
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
Controller::$currentController = $controller;
|
||||
return $customisedController->renderWith('Page');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a link to the password reset form
|
||||
*
|
||||
* @param string $autoLoginHash The auto login hash
|
||||
*/
|
||||
public static function getPasswordResetLink($autoLoginHash) {
|
||||
$autoLoginHash = urldecode($autoLoginHash);
|
||||
return self::Link('changepassword') . "?h=$autoLoginHash";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the "change password" page
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user