mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 16:44:44 +02:00
revert some changes in EditProfile
This commit is contained in:
parent
f43fb985a2
commit
70fc84309f
@ -31,6 +31,9 @@ use Illuminate\Support\Facades\Hash;
|
|||||||
use Illuminate\Support\HtmlString;
|
use Illuminate\Support\HtmlString;
|
||||||
use Illuminate\Validation\Rules\Password;
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method User getUser()
|
||||||
|
*/
|
||||||
class EditProfile extends \Filament\Pages\Auth\EditProfile
|
class EditProfile extends \Filament\Pages\Auth\EditProfile
|
||||||
{
|
{
|
||||||
protected function getForms(): array
|
protected function getForms(): array
|
||||||
@ -101,18 +104,15 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
|
|||||||
->icon('tabler-shield-lock')
|
->icon('tabler-shield-lock')
|
||||||
->schema(function () {
|
->schema(function () {
|
||||||
|
|
||||||
/** @var User */
|
if ($this->getUser()->use_totp) {
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
if (auth()->user()->use_totp) {
|
|
||||||
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!'),
|
||||||
Textarea::make('backup-tokens')
|
Textarea::make('backup-tokens')
|
||||||
->hidden(fn () => !cache()->get("users.{$user->id}.2fa.tokens"))
|
->hidden(fn () => !cache()->get("users.{$this->getUser()->id}.2fa.tokens"))
|
||||||
->rows(10)
|
->rows(10)
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->formatStateUsing(fn () => cache()->get("users.{$user->id}.2fa.tokens"))
|
->formatStateUsing(fn () => cache()->get("users.{$this->getUser()->id}.2fa.tokens"))
|
||||||
->helperText('These will not be shown again!')
|
->helperText('These will not be shown again!')
|
||||||
->label('Backup Tokens:'),
|
->label('Backup Tokens:'),
|
||||||
TextInput::make('2fa-disable-code')
|
TextInput::make('2fa-disable-code')
|
||||||
@ -124,8 +124,8 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
|
|||||||
$setupService = app(TwoFactorSetupService::class);
|
$setupService = app(TwoFactorSetupService::class);
|
||||||
|
|
||||||
['image_url_data' => $url, 'secret' => $secret] = cache()->remember(
|
['image_url_data' => $url, 'secret' => $secret] = cache()->remember(
|
||||||
"users.{$user->id}.2fa.state",
|
"users.{$this->getUser()->id}.2fa.state",
|
||||||
now()->addMinutes(5), fn () => $setupService->handle(auth()->user())
|
now()->addMinutes(5), fn () => $setupService->handle($this->getUser())
|
||||||
);
|
);
|
||||||
|
|
||||||
$options = new QROptions([
|
$options = new QROptions([
|
||||||
@ -265,7 +265,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->operation('edit')
|
->operation('edit')
|
||||||
->model(auth()->user())
|
->model($this->getUser())
|
||||||
->statePath('data')
|
->statePath('data')
|
||||||
->inlineLabel(!static::isSimple()),
|
->inlineLabel(!static::isSimple()),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user