Added Secuirty::set_default_login_dest() for developers to specify the default page to direct to after the log in

This results in more reliable log-in redirection

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62653 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-09-18 03:53:36 +00:00
parent a6577d9749
commit c20c4ae6b0
2 changed files with 21 additions and 1 deletions

View File

@ -109,7 +109,7 @@ class MemberLoginForm extends LoginForm {
Session::clear("BackURL");
Director::redirect($backURL);
} else {
Director::redirectBack();
Director::redirect(Security::default_login_dest());
}
} else {
Session::set('SessionForms.MemberLoginForm.Email', $data['Email']);

View File

@ -927,6 +927,26 @@ class Security extends Controller {
public static function login_recording() {
return self::$login_recording;
}
protected static $default_login_dest = "";
/**
* Set the default login dest
* This is the URL that users will be redirected to after they log in,
* if they haven't logged in en route to access a secured page.
*
* By default, this is set to the homepage
*/
public static function set_default_login_dest($dest) {
self::$default_login_dest = $dest;
}
/**
* Get the default login dest
*/
public static function default_login_dest() {
return self::$default_login_dest;
}
}