mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-05 17:55:37 +02:00
Uggg fixed admin redirect much more simply
This commit is contained in:
@@ -153,7 +153,8 @@ class Admin
|
||||
/** @var Grav $grav */
|
||||
$grav = $this->grav;
|
||||
|
||||
$redirect_route =$this->getLoginRedirect() ?: $this->uri->route();
|
||||
// $redirect_route =$this->getLoginRedirect() ?: $this->uri->route();
|
||||
$redirect_route = $this->uri->route();
|
||||
$grav->redirect($redirect_route);
|
||||
}
|
||||
}
|
||||
@@ -523,24 +524,4 @@ class Admin
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setLoginRedirect()
|
||||
{
|
||||
$uri = $this->grav['uri'];
|
||||
setcookie(LOGIN_REDIRECT_COOKIE, $uri->path(), time() + (86400 * 30), $this->grav['base_url_relative']);
|
||||
}
|
||||
|
||||
public function getLoginRedirect()
|
||||
{
|
||||
if (isset($_COOKIE[LOGIN_REDIRECT_COOKIE])) {
|
||||
$this->removeLoginRedirect();
|
||||
return $_COOKIE[LOGIN_REDIRECT_COOKIE];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function removeLoginRedirect()
|
||||
{
|
||||
return setcookie(LOGIN_REDIRECT_COOKIE, '', time() - 3600);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user