exists()) { $this->info('Clusev ist bereits installiert — kein Admin angelegt.'); return self::SUCCESS; } $email = (string) ($this->option('email') ?: self::DEFAULT_EMAIL); if (! filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->error("Ungueltige Admin-E-Mail: {$email}"); return self::FAILURE; } // Random, non-guessable initial password (printed once below). Satisfies any policy. $password = Str::password(16); $user = User::create([ 'name' => (string) ($this->option('name') ?: 'Administrator'), 'email' => $email, 'password' => $password, // 'hashed' cast hashes on save 'must_change_password' => true, // nudges a rotation on first login (optional) ]); // install.sh greps these two lines for the closing banner — this is the ONLY time the // generated password is shown, so the operator must note it now. $this->newLine(); $this->line('CLUSEV_ADMIN_EMAIL='.$user->email); $this->line('CLUSEV_ADMIN_PASSWORD='.$password); $this->newLine(); $this->info('Admin angelegt. Generiertes Passwort jetzt notieren — es wird nur einmal angezeigt.'); return self::SUCCESS; } }