From 58e1aec94b391e1fcf8faddb258f9c54b38c1bf9 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 31 Aug 2015 17:03:44 -0600 Subject: [PATCH] Check for existence of a user account --- admin.php | 7 +++++++ languages.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index b4ac4380..556282d3 100644 --- a/admin.php +++ b/admin.php @@ -137,6 +137,13 @@ 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']; diff --git a/languages.yaml b/languages.yaml index ce6dcfe9..f16eb8c0 100644 --- a/languages.yaml +++ b/languages.yaml @@ -416,9 +416,9 @@ en: USERNAME_HELP: Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed FULLY_UPDATED: Fully Updated SAVE_LOCATION: Save location - PAGE_FILE: Page File PAGE_FILE_HELP: Page file name, and by default the display template for this page + NO_USER_ACCOUNTS: No user accounts found, please create one first... es: PLUGIN_ADMIN: ADMIN_BETA_MSG: ¡Está es una versión Beta! Utilízala bajo tu propio riesgo...