- Offer workflow: "Angebot senden" in the admin (dates, guests, promo code, manual price adjustment, validity from the property's hold time, message, guest data for the contract) with live price; contract draft PDF; signed, versioned offer page for the guest to accept (acceptance record without IP) or decline; expiry job, landlord notifications, editable offer texts, wording on the website. - 2FA is mandatory for every admin account. - Privacy: complete anonymisation (notes, attribution, review names, offer messages), shorter periods for unbinding requests, portal mail excerpts and attribution (configurable proposals), iCal summary not stored, known e-mail no longer overwrites guest data, security headers, bearer tokens for automations, metadata stripped from photo originals, review link throttled. - Daily database backup (backup:database) and scripts/backup-pull.sh for the NAS. - Theme: brand mark in header/footer, favicon/touch icon, wave divider, icons, illustration as image placeholder; navy follows the text colour for dark appearances. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
2.3 KiB
PHP
63 lines
2.3 KiB
PHP
<?php
|
||
|
||
namespace App\Console\Commands;
|
||
|
||
use App\Enums\UserRole;
|
||
use App\Models\User;
|
||
use Illuminate\Console\Attributes\Description;
|
||
use Illuminate\Console\Attributes\Signature;
|
||
use Illuminate\Console\Command;
|
||
use Illuminate\Validation\Rules\Password;
|
||
|
||
use function Laravel\Prompts\password;
|
||
use function Laravel\Prompts\select;
|
||
use function Laravel\Prompts\text;
|
||
|
||
#[Signature('users:create {email? : E-Mail-Adresse} {--name= : Name} {--role= : admin, rentals oder content}')]
|
||
#[Description('Create an admin panel account (the password is entered interactively and never passed as an argument)')]
|
||
class CreateUser extends Command
|
||
{
|
||
/**
|
||
* Execute the console command.
|
||
*/
|
||
public function handle(): int
|
||
{
|
||
$email = $this->argument('email') ?? text('E-Mail-Adresse', required: true, validate: ['email' => 'email']);
|
||
$email = mb_strtolower(trim($email));
|
||
|
||
if (User::where('email', $email)->exists()) {
|
||
$this->error("Es gibt bereits einen Benutzer mit {$email}.");
|
||
|
||
return self::FAILURE;
|
||
}
|
||
|
||
$name = $this->option('name') ?? text('Name', required: true);
|
||
|
||
$role = $this->option('role') !== null
|
||
? UserRole::tryFrom($this->option('role'))
|
||
: UserRole::from(select('Rolle', collect(UserRole::cases())->mapWithKeys(fn (UserRole $role): array => [$role->value => "{$role->getLabel()} – {$role->getDescription()}"])->all(), default: UserRole::Admin->value));
|
||
|
||
if ($role === null) {
|
||
$this->error('Unbekannte Rolle. Erlaubt: '.implode(', ', array_column(UserRole::cases(), 'value')));
|
||
|
||
return self::FAILURE;
|
||
}
|
||
|
||
$password = password('Passwort (mind. 12 Zeichen)', required: true, validate: ['password' => Password::min(12)]);
|
||
|
||
if (password('Passwort wiederholen', required: true) !== $password) {
|
||
$this->error('Die Passwörter stimmen nicht überein.');
|
||
|
||
return self::FAILURE;
|
||
}
|
||
|
||
User::create(['name' => $name, 'email' => $email, 'role' => $role, 'password' => $password]);
|
||
|
||
$this->info("Benutzer {$email} ({$role->getLabel()}) angelegt.");
|
||
|
||
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
}
|