Reset TwoFactorAuthentication

This commit is contained in:
Ralph J. Smit
2022-08-08 11:09:13 +02:00
parent 93273b5a45
commit c5dbfa2c4b

View File

@@ -3,6 +3,7 @@
namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource;
use Filament\Notifications\Notification;
use Filament\Pages\Actions;
use Filament\Resources\Pages\EditRecord;
@@ -13,6 +14,19 @@ class EditUser extends EditRecord
protected function getActions(): array
{
return [
Actions\Action::make('two_factor_authentication')
->label(__('Disable two-factor authentication'))
->color('secondary')
->action(function () {
$this->record->disableTwoFactorAuth();
Notification::make()
->body(__('Two-factor authentication disabled'))
->success()
->send();
})
->visible(fn () => $this->record->hasTwoFactorEnabled())
->requiresConfirmation(),
Actions\DeleteAction::make(),
];
}