diff --git a/CHANGELOG.md b/CHANGELOG.md index ea98d9e2..bd39c7df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.9.0-beta.7 +## mm/dd/2018 + +1. [](#bugfix) + * Fixed user login / remember me triggering before admin gets initialized + # v1.9.0-beta.6 ## 11/12/2018 diff --git a/admin.php b/admin.php index aa1b419f..62dbacbe 100644 --- a/admin.php +++ b/admin.php @@ -649,13 +649,9 @@ class AdminPlugin extends Plugin $this->route = array_shift($array); } - // Initialize admin class. + // Initialize admin class (also registers it to Grav services). $this->admin = new Admin($this->grav, $this->admin_route, $this->template, $this->route); - - // And store the class into DI container. - $this->grav['admin'] = $this->admin; - // Double check we have system.yaml, site.yaml etc $config_path = $this->grav['locator']->findResource('user://config'); foreach ($this->admin->configurations() as $config_file) { diff --git a/classes/admin.php b/classes/admin.php index 6fc56b4e..94055722 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -128,15 +128,18 @@ class Admin */ public function __construct(Grav $grav, $base, $location, $route) { + // Register admin to grav because of calling $grav['user'] requires it. + $grav['admin'] = $this; + $this->grav = $grav; $this->base = $base; $this->location = $location; $this->route = $route; - $this->uri = $this->grav['uri']; - $this->session = $this->grav['session']; - $this->user = $this->grav['user']; + $this->uri = $grav['uri']; + $this->session = $grav['session']; + $this->user = $grav['user']; $this->permissions = []; - $language = $this->grav['language']; + $language = $grav['language']; // Load utility class if ($language->enabled()) {