diff --git a/app/Console/Commands/CompleteSetupCommand.php b/app/Console/Commands/CompleteSetupCommand.php index cdca3f4f..fd945e26 100644 --- a/app/Console/Commands/CompleteSetupCommand.php +++ b/app/Console/Commands/CompleteSetupCommand.php @@ -24,7 +24,7 @@ class CompleteSetupCommand extends Command return; } - $this->info('Successfully marked the setup as completed. You can now visit the web interface.'); - $this->line('Hint: If you install LinkAce with PostgreSQL or SQLite, use the registeruser command now.'); + $this->info('Successfully marked the setup as completed.'); + $this->info('Use the php artisan registeruser --admin command now to create your first admin user.'); } } diff --git a/app/Console/Commands/RegisterUserCommand.php b/app/Console/Commands/RegisterUserCommand.php index f40f4eae..792eee2c 100644 --- a/app/Console/Commands/RegisterUserCommand.php +++ b/app/Console/Commands/RegisterUserCommand.php @@ -4,6 +4,7 @@ namespace App\Console\Commands; use App\Actions\Fortify\CreateNewUser; use App\Enums\Role; +use App\Models\User; use Illuminate\Console\Command; use Illuminate\Validation\ValidationException; @@ -19,6 +20,11 @@ class RegisterUserCommand extends Command public function handle(): void { + if ($this->option('admin') === false && User::query()->count() <= 1) { + $this->warn('It seems you are creating the first user. This user should be an admin!'); + $this->warn('Please consider running the command with --admin again.'); + } + $this->userName = $this->argument('name'); $this->userEmail = $this->argument('email'); @@ -52,7 +58,8 @@ class RegisterUserCommand extends Command protected function askForUserDetails(): void { if (empty($this->userName) || $this->validationFailed) { - $this->userName = $this->ask('Please enter the user name containing only alpha-numeric characters, dashes or underscores', $this->userName); + $this->userName = $this->ask('Please enter the user name containing only alpha-numeric characters, dashes or underscores', + $this->userName); } if (empty($this->userEmail) || $this->validationFailed) {