Made logout redirect to last visted page
This commit is contained in:
parent
8b8564309d
commit
e857032a73
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ class AuthController
|
||||||
|
|
||||||
//check if already logged in
|
//check if already logged in
|
||||||
if (Auth::isLoggedIn())
|
if (Auth::isLoggedIn())
|
||||||
self::redirectAfterLog();
|
self::redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loginAction()
|
public function loginAction()
|
||||||
|
@ -17,13 +17,13 @@ class AuthController
|
||||||
$suppliedPassword = InputHelper::get('password');
|
$suppliedPassword = InputHelper::get('password');
|
||||||
$remember = boolval(InputHelper::get('remember'));
|
$remember = boolval(InputHelper::get('remember'));
|
||||||
Auth::login($suppliedName, $suppliedPassword, $remember);
|
Auth::login($suppliedName, $suppliedPassword, $remember);
|
||||||
self::redirectAfterLog();
|
self::redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logoutAction()
|
public function logoutAction()
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
\Chibi\Util\Url::forward(\Chibi\Router::linkTo(['IndexController', 'indexAction']));
|
self::redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function observeWorkFinish()
|
public static function observeWorkFinish()
|
||||||
|
@ -38,7 +38,7 @@ class AuthController
|
||||||
$_SESSION['login-redirect-url'] = $context->query;
|
$_SESSION['login-redirect-url'] = $context->query;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function redirectAfterLog()
|
private static function redirect()
|
||||||
{
|
{
|
||||||
if (isset($_SESSION['login-redirect-url']))
|
if (isset($_SESSION['login-redirect-url']))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue