From d14b9ff83c1ddeff932049a0113dfc585f42fbc4 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 16 Jan 2016 21:42:46 -0500 Subject: [PATCH] Add command line ability to create user --- app/Console/Commands/MakeUser.php | 61 +++++++++++++++++++++++++++++++ app/Console/Kernel.php | 1 + 2 files changed, 62 insertions(+) create mode 100644 app/Console/Commands/MakeUser.php diff --git a/app/Console/Commands/MakeUser.php b/app/Console/Commands/MakeUser.php new file mode 100644 index 000000000..f89ad588d --- /dev/null +++ b/app/Console/Commands/MakeUser.php @@ -0,0 +1,61 @@ +ask('Email'); + $password = $this->secret('Password'); + $password_confirmation = $this->secret('Confirm Password'); + + if ($password !== $password_confirmation) { + return $this->error('The passwords provided did not match!'); + } + + $admin = $this->confirm('Is this user a root administrator?'); + + try { + $user = new UserRepository; + $user->create($email, $password, $admin); + return $this->info('User successfully created.'); + } catch (\Exception $ex) { + return $this->error($ex->getMessage()); + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 8a64907c5..73478a6da 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -14,6 +14,7 @@ class Kernel extends ConsoleKernel */ protected $commands = [ \Pterodactyl\Console\Commands\Inspire::class, + \Pterodactyl\Console\Commands\MakeUser::class, ]; /**