Skip to content

Commit

Permalink
redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
angie committed Apr 12, 2024
1 parent 1b9c86a commit 4b00cc6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Pages/TwoFactorAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function getRelativeRouteName(): string

public function mount()
{
if (! Filament::auth()->user() instanceof RequireTwoFALogin) {
if (!Filament::auth()->user() instanceof RequireTwoFALogin) {
return redirect(Filament::getUrl());
}
$this->email = Filament::auth()->user()->email;

Check failure on line 50 in src/Pages/TwoFactorAuth.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Illuminate\Foundation\Auth\User&Solutionforest\FilamentEmail2fa\Interfaces\RequireTwoFALogin::$email.
Expand All @@ -58,16 +58,21 @@ public function resend()
session()->flash('resent-success', __('filament-email-2fa::filament-email-2fa.resend_success'));

return;

}
}

public function logout()
{
Filament::auth()->logout();
session()->regenerate();

return redirect(Filament::getLoginUrl());
session()->invalidate();
session()->regenerateToken();

return redirect()->to(

Filament::hasLogin() ? Filament::getLoginUrl() : Filament::getUrl(),

);
}

public function getFormActions(): array
Expand Down Expand Up @@ -112,7 +117,6 @@ public function save()

return;
}

}

public function getUser()
Expand All @@ -128,7 +132,6 @@ public function getUser()
public function getCurrentGuard()
{
return Filament::getCurrentPanel()->getAuthGuard();

}

public function form(Form $form): Form
Expand Down

0 comments on commit 4b00cc6

Please sign in to comment.