Merge branch 'hailwood/patch-5' into 3

This commit is contained in:
Daniel Hensby 2016-07-01 14:49:25 +01:00
commit ee326f6394
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
2 changed files with 25 additions and 5 deletions

View File

@ -102,7 +102,7 @@ class MemberLoginForm extends LoginForm {
FormAction::create('dologin', _t('Member.BUTTONLOGIN', "Log in")), FormAction::create('dologin', _t('Member.BUTTONLOGIN', "Log in")),
LiteralField::create( LiteralField::create(
'forgotPassword', '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>' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
) )
); );

View File

@ -129,6 +129,15 @@ class Security extends Controller implements TemplateGlobalProvider {
*/ */
private static $logout_url = "Security/logout"; 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 * Get location of word list file
* *
@ -651,9 +660,9 @@ class Security extends Controller implements TemplateGlobalProvider {
* @param string $autoLoginHash The auto login token. * @param string $autoLoginHash The auto login token.
*/ */
public static function getPasswordResetLink($member, $autologinToken) { public static function getPasswordResetLink($member, $autologinToken) {
$autologinToken = urldecode($autologinToken); $autologinToken = urldecode($autologinToken);
$selfControllerClass = __CLASS__; $selfControllerClass = __CLASS__;
$selfController = new $selfControllerClass(); $selfController = new $selfControllerClass();
return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken"; return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
} }
@ -1108,7 +1117,7 @@ class Security extends Controller implements TemplateGlobalProvider {
* @return string * @return string
*/ */
public static function login_url() { public static function login_url() {
return self::config()->login_url; return Controller::join_links(Director::baseURL(), self::config()->login_url);
} }
@ -1120,9 +1129,19 @@ class Security extends Controller implements TemplateGlobalProvider {
* @return string * @return string
*/ */
public static function logout_url() { 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. * Defines global accessible templates variables.
@ -1133,6 +1152,7 @@ class Security extends Controller implements TemplateGlobalProvider {
return array( return array(
"LoginURL" => "login_url", "LoginURL" => "login_url",
"LogoutURL" => "logout_url", "LogoutURL" => "logout_url",
"LostPasswordURL" => "lost_password_url",
); );
} }