diff options
Diffstat (limited to 'install/index.php')
-rw-r--r-- | install/index.php | 16 |
1 files changed, 16 insertions, 0 deletions
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'])) { <ol> <li><a href="?create_tables">Create database tables</a></li> <li><a href="?create_folders">Create folders</a></li> + <li><a href="?create_user">Create a user</a></li> <li><a href="?password_cost">Finding a good password cost</a></li> </ol> |