mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 03:16:11 +01:00
Do not redirect to /admin for login if admin page does not exist
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Use `Url:post()` to get the `$_POST` variable (allows common security checks/filtering for the POST data)
|
* Use `Url:post()` to get the `$_POST` variable (allows common security checks/filtering for the POST data)
|
||||||
* Make all form fields to extend field.html.twig
|
* Make all form fields to extend field.html.twig
|
||||||
|
* Do not redirect to `/admin` for login if admin page does not exist
|
||||||
|
|
||||||
# v1.8.9
|
# v1.8.9
|
||||||
## 08/23/2018
|
## 08/23/2018
|
||||||
|
|||||||
@@ -434,7 +434,13 @@ class AdminPlugin extends Plugin
|
|||||||
throw new \RuntimeException('Page Not Found', 404);
|
throw new \RuntimeException('Page Not Found', 404);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->grav->redirect($this->admin_route);
|
// Not Found and not logged in: Display login page.
|
||||||
|
$login_file = $this->grav['locator']->findResource('plugins://admin/pages/admin/login.md');
|
||||||
|
$page = new Page();
|
||||||
|
$page->init(new \SplFileInfo($login_file));
|
||||||
|
$page->slug(basename($this->route));
|
||||||
|
unset($this->grav['page']);
|
||||||
|
$this->grav['page'] = $page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user