Force app panel for EditProfile (#1162)

* Force `app` panel for `EditProfile`

* Force `app` panel for `OAuthController`

* Use translation in `AdminPanelProvider`

Co-authored-by: Boy132 <Boy132@users.noreply.github.com>

---------

Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
MartinOscar 2025-03-27 18:54:08 +01:00 committed by GitHub
parent 3310746107
commit 9a258efe53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -261,7 +261,7 @@ class EditProfile extends BaseEditProfile
Action::make('Create')
->label(trans('filament-actions::create.single.modal.actions.create.label'))
->disabled(fn (Get $get) => $get('description') === null)
->successRedirectUrl(self::getUrl(['tab' => '-api-keys-tab']))
->successRedirectUrl(self::getUrl(['tab' => '-api-keys-tab'], panel: 'app'))
->action(function (Get $get, Action $action, User $user) {
$token = $user->createToken(
$get('description'),
@ -345,7 +345,7 @@ class EditProfile extends BaseEditProfile
$tokens = $this->toggleTwoFactorService->handle($record, $token, true);
cache()->put("users.$record->id.2fa.tokens", implode("\n", $tokens), now()->addSeconds(15));
$this->redirectRoute('filament.admin.auth.profile', ['tab' => '-2fa-tab']);
$this->redirect(self::getUrl(['tab' => '-2fa-tab'], panel: 'app'));
}
if ($token = $data['2fa-disable-code'] ?? null) {

View File

@ -53,7 +53,7 @@ class OAuthController extends Controller
$this->updateService->handle($request->user(), ['oauth' => $oauth]);
return redirect(EditProfile::getUrl(['tab' => '-oauth-tab']));
return redirect(EditProfile::getUrl(['tab' => '-oauth-tab'], panel: 'app'));
}
try {

View File

@ -38,9 +38,9 @@ class AdminPanelProvider extends PanelProvider
->favicon(config('app.favicon', '/pelican.ico'))
->topNavigation(config('panel.filament.top-navigation', true))
->maxContentWidth(config('panel.filament.display-width', 'screen-2xl'))
->profile(EditProfile::class, false)
->login(Login::class)
->userMenuItems([
'profile' => MenuItem::make()->label(trans('filament-panels::pages/auth/edit-profile.label'))->url(fn () => EditProfile::getUrl(panel: 'app')),
MenuItem::make()
->label(trans('profile.exit_admin'))
->url('/')