Making login redirect you to where you were trying to go after logging in.
This commit is contained in:
parent
d9264378e7
commit
83a74952ee
2 changed files with 14 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ class SessionController extends \PHPCI\Controller
|
|||
|
||||
if ($user && password_verify($this->getParam('password', ''), $user->getHash())) {
|
||||
$_SESSION['user_id'] = $user->getId();
|
||||
header('Location: ' . PHPCI_URL);
|
||||
header('Location: ' . $this->getLoginRedirect());
|
||||
die;
|
||||
} else {
|
||||
$isLoginFailure = true;
|
||||
|
|
@ -159,4 +159,16 @@ MSG;
|
|||
|
||||
return $this->view->render();
|
||||
}
|
||||
|
||||
protected function getLoginRedirect()
|
||||
{
|
||||
$rtn = PHPCI_URL;
|
||||
|
||||
if (!empty($_SESSION['login_redirect'])) {
|
||||
$rtn .= $_SESSION['login_redirect'];
|
||||
$_SESSION['login_redirect'] = null;
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue