From adde4aa4677eabbc787793b9a688fea061477b31 Mon Sep 17 00:00:00 2001 From: Mauro Martinez Date: Fri, 5 Aug 2022 11:40:54 +0300 Subject: [PATCH] Fixe guard for getUser method --- src/app/CustomCheckAuthenticator.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/CustomCheckAuthenticator.php b/src/app/CustomCheckAuthenticator.php index b70ccc5..1b95efc 100644 --- a/src/app/CustomCheckAuthenticator.php +++ b/src/app/CustomCheckAuthenticator.php @@ -2,7 +2,9 @@ namespace MHMartinez\TwoFactorAuth\app; +use Illuminate\Support\Facades\Auth; use PragmaRX\Google2FALaravel\Support\Authenticator; +use Illuminate\Contracts\Auth\Authenticatable; class CustomCheckAuthenticator extends Authenticator { @@ -13,4 +15,12 @@ public function isActivated(): bool { return true; } + + /** + * We override the getUser method to return the one with the right guard + */ + protected function getUser(): Authenticatable|null + { + return Auth::guard(config('two_factor_auth.guard'))->user(); + } } \ No newline at end of file