mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-04-04 19:58:49 +02:00
Fixed admin controller running before setting $grav['page']
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* Fixed admin user creation and password reset allowing unsafe passwords
|
||||
* Fixed missing validation when registering the first admin user
|
||||
* Fixed reset password email not to have session specific token in it
|
||||
* Fixed admin controller running before setting `$grav['page']`
|
||||
|
||||
# v1.10.7
|
||||
## 03/17/2021
|
||||
|
||||
36
admin.php
36
admin.php
@@ -449,22 +449,9 @@ class AdminPlugin extends Plugin
|
||||
|
||||
$this->grav['page'] = $page;
|
||||
$this->admin->form = $controller->getActiveForm();
|
||||
$legacyController = false;
|
||||
} else {
|
||||
// Handle tasks.
|
||||
$this->admin->task = $task = $this->grav['task'] ?? $this->grav['action'];
|
||||
if ($task) {
|
||||
Admin::DEBUG && Admin::addDebugMessage("Admin task: {$task}");
|
||||
|
||||
// Make local copy of POST.
|
||||
$post = $this->grav['uri']->post();
|
||||
|
||||
$this->initializeController($task, $post);
|
||||
} elseif ($this->template === 'logs' && $this->route) {
|
||||
// Display RAW error message.
|
||||
$response = new Response(200, [], $this->admin->logEntry());
|
||||
|
||||
$this->grav->close($response);
|
||||
}
|
||||
$legacyController = true;
|
||||
}
|
||||
|
||||
// Replace page service with admin.
|
||||
@@ -558,6 +545,25 @@ class AdminPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if ($legacyController) {
|
||||
// Handle tasks.
|
||||
$this->admin->task = $task = $this->grav['task'] ?? $this->grav['action'];
|
||||
if ($task) {
|
||||
Admin::DEBUG && Admin::addDebugMessage("Admin task: {$task}");
|
||||
|
||||
// Make local copy of POST.
|
||||
$post = $this->grav['uri']->post();
|
||||
|
||||
$this->initializeController($task, $post);
|
||||
} elseif ($this->template === 'logs' && $this->route) {
|
||||
// Display RAW error message.
|
||||
$response = new Response(200, [], $this->admin->logEntry());
|
||||
|
||||
$this->grav->close($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Explicitly set a timestamp on assets
|
||||
$this->grav['assets']->setTimestamp(substr(md5(GRAV_VERSION . $this->grav['config']->checksum()), 0, 10));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user