mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Make lost password url a config option like login_url and logout_url
Also makes the login_url, logout_url and new lost_password_url functions return their link relative to the base url rather than assuming the base tag
This commit is contained in:
parent
390b1fc6c4
commit
4f0969f119
@ -102,7 +102,7 @@ class MemberLoginForm extends LoginForm {
|
||||
FormAction::create('dologin', _t('Member.BUTTONLOGIN', "Log in")),
|
||||
LiteralField::create(
|
||||
'forgotPassword',
|
||||
'<p id="ForgotPassword"><a href="Security/lostpassword">'
|
||||
'<p id="ForgotPassword"><a href="' . Security::lost_password_url() . '">'
|
||||
. _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
|
||||
)
|
||||
);
|
||||
|
@ -129,6 +129,15 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
*/
|
||||
private static $logout_url = "Security/logout";
|
||||
|
||||
/**
|
||||
* The default lost password URL
|
||||
*
|
||||
* @config
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $lost_password_url = "Security/lostpassword";
|
||||
|
||||
/**
|
||||
* Get location of word list file
|
||||
*
|
||||
@ -650,10 +659,11 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
* @param Member $member Member object associated with this link.
|
||||
* @param string $autoLoginHash The auto login token.
|
||||
*/
|
||||
public static function getPasswordResetLink($member, $autologinToken) {
|
||||
$autologinToken = urldecode($autologinToken);
|
||||
public static function getPasswordResetLink($member, $autologinToken)
|
||||
{
|
||||
$autologinToken = urldecode($autologinToken);
|
||||
$selfControllerClass = __CLASS__;
|
||||
$selfController = new $selfControllerClass();
|
||||
$selfController = new $selfControllerClass();
|
||||
return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
|
||||
}
|
||||
|
||||
@ -1108,7 +1118,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
* @return string
|
||||
*/
|
||||
public static function login_url() {
|
||||
return self::config()->login_url;
|
||||
return Controller::join_links(Director::baseURL(), self::config()->login_url);
|
||||
}
|
||||
|
||||
|
||||
@ -1120,9 +1130,20 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
* @return string
|
||||
*/
|
||||
public static function logout_url() {
|
||||
return self::config()->logout_url;
|
||||
return Controller::join_links(Director::baseURL(), self::config()->logout_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL of the logout page.
|
||||
*
|
||||
* To update the logout url use the "Security.logout_url" config setting.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function lost_password_url()
|
||||
{
|
||||
return Controller::join_links(Director::baseURL(), self::config()->lost_password_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines global accessible templates variables.
|
||||
@ -1133,6 +1154,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
return array(
|
||||
"LoginURL" => "login_url",
|
||||
"LogoutURL" => "logout_url",
|
||||
"LostPasswordURL" => "lost_password_url"
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user