mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-06 13:25:46 +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
16
admin.php
16
admin.php
@@ -374,13 +374,17 @@ class AdminPlugin extends Plugin
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (empty($this->grav['page'])) {
|
if (empty($this->grav['page'])) {
|
||||||
$event = $this->grav->fireEvent('onPageNotFound');
|
if($this->session->user->count()){
|
||||||
|
$event = $this->grav->fireEvent('onPageNotFound');
|
||||||
|
|
||||||
if (isset($event->page)) {
|
if (isset($event->page)) {
|
||||||
unset($this->grav['page']);
|
unset($this->grav['page']);
|
||||||
$this->grav['page'] = $event->page;
|
$this->grav['page'] = $event->page;
|
||||||
} else {
|
} else {
|
||||||
throw new \RuntimeException('Page Not Found', 404);
|
throw new \RuntimeException('Page Not Found', 404);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->grav->redirect($this->base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user