exists()) { $this->info('Clusev ist bereits installiert — kein Admin angelegt.'); return self::SUCCESS; } $host = parse_url((string) config('app.url'), PHP_URL_HOST) ?: 'localhost'; $email = (string) ($this->option('email') ?: "admin@{$host}"); if (! filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->error("Ungueltige Admin-E-Mail: {$email}"); return self::FAILURE; } $password = Str::password(20); $user = User::create([ 'name' => (string) ($this->option('name') ?: 'Administrator'), 'email' => $email, 'password' => $password, // 'hashed' cast hashes on save 'must_change_password' => true, // forces rotate + 2FA on first login ]); // One-time password marker — the ONLY place the plaintext appears. // install.sh greps these two lines for the closing banner; never stored. $this->newLine(); $this->line('CLUSEV_ADMIN_EMAIL='.$user->email); $this->line('CLUSEV_ADMIN_PASSWORD='.$password); $this->newLine(); $this->info('Admin angelegt. Passwort erscheint nur jetzt und wird nicht gespeichert.'); return self::SUCCESS; } }