#1457 - Redirection after login doesn't behave correctly if login fails

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.1.1@43599 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-18 23:41:30 +00:00 committed by Sam Minnee
parent 99b3728e6d
commit b9492c67c5

View File

@ -19,7 +19,7 @@ class LoginForm extends Form {
$fields = new FieldSet(
new TextField("Email", "Email address", Session::get('SessionForms.LoginForm.Email')),
new EncryptField("Password", "Password"),
new CheckboxField("Remember", "Remember me next time?",true)
new CheckboxField("Remember", "Remember me next time?", true)
);
}
if(!$actions) {
@ -46,17 +46,21 @@ class LoginForm extends Form {
}
public function dologin($data) {
if($this->performLogin($data)){
if($this->performLogin($data)) {
if(isset($_REQUEST['BackURL']) && $backURL = $_REQUEST['BackURL']) {
Session::clear("BackURL");
Director::redirect($backURL);
}else
} else {
Director::redirectBack();
}else{
}
} else {
if(isset($_REQUEST['BackURL']) && $backURL = $_REQUEST['BackURL']) {
Session::set('BackURL', $backURL);
}
if($badLoginURL = Session::get("BadLoginURL")){
if($badLoginURL = Session::get("BadLoginURL")) {
Director::redirect($badLoginURL);
}else{
} else {
Director::redirectBack();
}
}