From 5528a63784882d11d02f5f8ce568997f751b28ec Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 26 Jul 2016 13:20:51 +0200 Subject: Option to add first user during installation --- install/index.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'install') diff --git a/install/index.php b/install/index.php index 41fb450..878fe38 100644 --- a/install/index.php +++ b/install/index.php @@ -128,6 +128,21 @@ if (isset($_GET['create_folders'])) { } } +if (isset($_GET['create_user'])) { + $username = 'admin'; + try { + $password = bin2hex(openssl_random_pseudo_bytes(8)); + $user = BusinessAdmin::createUser($_pdo, $username, $password); + if ($user !== false) { + echo "Created user '$username' ({$user->getId()}) with password '$password'."; + } else { + echo "Unknown error while creating the admin user."; + } + } catch (PDOException $e) { + echo "Creating an admin user failed (does one exist already?)."; + } +} + if (isset($_GET['password_cost'])) { $target = 1; $start = $end = 0; @@ -147,6 +162,7 @@ if (isset($_GET['password_cost'])) {
  1. Create database tables
  2. Create folders
  3. +
  4. Create a user
  5. Finding a good password cost
-- cgit v1.2.3