mailwolt/app/Livewire/Ui/Security/Auth2faForm.php

43 lines
1.0 KiB
PHP

<?php
namespace App\Livewire\Ui\Security;
use Illuminate\Validation\Rule;
use Livewire\Component;
class Auth2faForm extends Component
{
/** 2FA global erzwingen (Benutzer müssen 2FA einrichten) */
public bool $enforce = false;
public bool $allow_totp = false; // <- vorher true
public bool $allow_email = false; // <- vorher true
protected function rules(): array
{
return [
'enforce' => ['boolean'],
'allow_totp' => ['boolean'],
'allow_email' => ['boolean'],
];
}
public function save(): void
{
$this->validate();
// TODO: Werte persistieren (DB/Settings)
// settings()->put('security.2fa', [
// 'enforce' => $this->enforce,
// 'allow_totp' => $this->allow_totp,
// 'allow_email' => $this->allow_email,
// ]);
$this->dispatch('toast', body: '2FA-Einstellungen gespeichert.');
}
public function render()
{
return view('livewire.ui.security.auth2fa-form');
}
}