X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/07b889547d28e68e5fc8f923c166bd607da17ad7..refs/pull/2902/head:/app/Console/Commands/CreateAdmin.php diff --git a/app/Console/Commands/CreateAdmin.php b/app/Console/Commands/CreateAdmin.php index 90c1ddb1c..a0fb8f315 100644 --- a/app/Console/Commands/CreateAdmin.php +++ b/app/Console/Commands/CreateAdmin.php @@ -28,8 +28,6 @@ class CreateAdmin extends Command /** * Create a new command instance. - * - * @param UserRepo $userRepo */ public function __construct(UserRepo $userRepo) { @@ -40,8 +38,9 @@ class CreateAdmin extends Command /** * Execute the console command. * - * @return mixed * @throws \BookStack\Exceptions\NotFoundException + * + * @return mixed */ public function handle() { @@ -49,7 +48,7 @@ class CreateAdmin extends Command if (empty($email)) { $email = $this->ask('Please specify an email address for the new admin user'); } - if (strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) { + if (mb_strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) { return $this->error('Invalid email address provided'); } @@ -61,7 +60,7 @@ class CreateAdmin extends Command if (empty($name)) { $name = $this->ask('Please specify an name for the new admin user'); } - if (strlen($name) < 2) { + if (mb_strlen($name) < 2) { return $this->error('Invalid name provided'); } @@ -69,11 +68,10 @@ class CreateAdmin extends Command if (empty($password)) { $password = $this->secret('Please specify a password for the new admin user'); } - if (strlen($password) < 5) { + if (mb_strlen($password) < 5) { return $this->error('Invalid password provided, Must be at least 5 characters'); } - $user = $this->userRepo->create(['email' => $email, 'name' => $name, 'password' => $password]); $this->userRepo->attachSystemRole($user, 'admin'); $this->userRepo->downloadAndAssignUserAvatar($user);