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, ]; /**