mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 11:26:04 +01:00
started work on admin registration logic
This commit is contained in:
15
admin.php
15
admin.php
@@ -153,13 +153,6 @@ class AdminPlugin extends Plugin
|
||||
$this->session->expert = false;
|
||||
}
|
||||
|
||||
// check for existence of a user account
|
||||
$account_dir = $file_path = $this->grav['locator']->findResource('account://');
|
||||
$user_check = (array) glob($account_dir . '/*.yaml');
|
||||
if (!count($user_check) > 0) {
|
||||
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.NO_USER_ACCOUNTS'), 'info');
|
||||
}
|
||||
|
||||
/** @var Pages $pages */
|
||||
$pages = $this->grav['pages'];
|
||||
|
||||
@@ -402,6 +395,14 @@ class AdminPlugin extends Plugin
|
||||
$path = trim(substr($this->uri->route(), strlen($this->base)), '/');
|
||||
$this->template = 'dashboard';
|
||||
|
||||
// check for existence of a user account
|
||||
$account_dir = $file_path = $this->grav['locator']->findResource('account://');
|
||||
$user_check = (array) glob($account_dir . '/*.yaml');
|
||||
if (!count($user_check) > 0) {
|
||||
// $this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.NO_USER_ACCOUNTS'), 'info');
|
||||
$this->template = 'register';
|
||||
}
|
||||
|
||||
if ($path) {
|
||||
$array = explode('/', $path, 2);
|
||||
$this->template = array_shift($array);
|
||||
|
||||
Reference in New Issue
Block a user