mirror of https://github.com/pixelfed/pixelfed.git
Update UserCreate command, closes #2581
This commit is contained in:
parent
e8cc66dce7
commit
b2b8c9f99c
|
@ -12,7 +12,7 @@ class UserCreate extends Command
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'user:create';
|
protected $signature = 'user:create {--name=} {--username=} {--email=} {--password=} {--is_admin=0} {--confirm_email=0}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
|
@ -40,6 +40,26 @@ class UserCreate extends Command
|
||||||
{
|
{
|
||||||
$this->info('Creating a new user...');
|
$this->info('Creating a new user...');
|
||||||
|
|
||||||
|
$o = $this->options();
|
||||||
|
|
||||||
|
if( $o['name'] &&
|
||||||
|
$o['username'] &&
|
||||||
|
$o['email'] &&
|
||||||
|
$o['password']
|
||||||
|
) {
|
||||||
|
$user = new User;
|
||||||
|
$user->username = $o['username'];
|
||||||
|
$user->name = $o['name'];
|
||||||
|
$user->email = $o['email'];
|
||||||
|
$user->password = bcrypt($o['password']);
|
||||||
|
$user->is_admin = (bool) $o['is_admin'];
|
||||||
|
$user->email_verified_at = (bool) $o['confirm_email'] ? now() : null;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$this->info('Successfully created user!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$name = $this->ask('Name');
|
$name = $this->ask('Name');
|
||||||
|
|
||||||
$username = $this->ask('Username');
|
$username = $this->ask('Username');
|
||||||
|
|
Loading…
Reference in New Issue