]> BookStack Code Mirror - bookstack/blobdiff - app/Console/Commands/CreateAdmin.php
Fixes padding issues of the sidebar's items
[bookstack] / app / Console / Commands / CreateAdmin.php
index 90c1ddb1c325e4e67761b5a81d9d602ad254c103..a0fb8f31506899d83a2af899efb3d3613300ee41 100644 (file)
@@ -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);