mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-06 05:15:43 +01:00
If user not logged in redirect to base path (#445)
Solved problem when user not logged in can go to admin/something and view admin dashboard with Error 404.
This commit is contained in:
committed by
Flavio Copes
parent
2cc07fe883
commit
b180e13e8e
@@ -374,6 +374,7 @@ class AdminPlugin extends Plugin
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (empty($this->grav['page'])) {
|
if (empty($this->grav['page'])) {
|
||||||
|
if($this->session->user->count()){
|
||||||
$event = $this->grav->fireEvent('onPageNotFound');
|
$event = $this->grav->fireEvent('onPageNotFound');
|
||||||
|
|
||||||
if (isset($event->page)) {
|
if (isset($event->page)) {
|
||||||
@@ -382,6 +383,9 @@ class AdminPlugin extends Plugin
|
|||||||
} else {
|
} else {
|
||||||
throw new \RuntimeException('Page Not Found', 404);
|
throw new \RuntimeException('Page Not Found', 404);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$this->grav->redirect($this->base);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly set a timestamp on assets
|
// Explicitly set a timestamp on assets
|
||||||
|
|||||||
Reference in New Issue
Block a user