Show backup tokens better

This commit is contained in:
Lance Pioch 2024-06-01 12:49:36 -04:00
parent 7762e68a6c
commit 67cb3d4816

View File

@ -22,6 +22,7 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\Tabs; use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TagsInput; use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\Tabs\Tab; use Filament\Forms\Components\Tabs\Tab;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Get; use Filament\Forms\Get;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
@ -104,10 +105,12 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
return [ return [
Placeholder::make('2fa-already-enabled') Placeholder::make('2fa-already-enabled')
->label('Two Factor Authentication is currently enabled!'), ->label('Two Factor Authentication is currently enabled!'),
Placeholder::make('backup-tokens') Textarea::make('backup-tokens')
->hidden(fn () => !cache()->get("users.{$this->getUser()->id}.2fa.tokens")) ->hidden(fn () => !cache()->get("users.{$this->getUser()->id}.2fa.tokens"))
->helperText(cache()->get("users.{$this->getUser()->id}.2fa.tokens") . ->rows(10)
' - these will not be shown again!') ->readOnly()
->formatStateUsing(fn () => cache()->get("users.{$this->getUser()->id}.2fa.tokens"))
->helperText('These will not be shown again!')
->label('Backup Tokens:'), ->label('Backup Tokens:'),
TextInput::make('2fa-disable-code') TextInput::make('2fa-disable-code')
->label('Disable 2FA') ->label('Disable 2FA')