Skip to content

Commit

Permalink
Fixe guard for getUser method
Browse files Browse the repository at this point in the history
  • Loading branch information
maurohmartinez committed Aug 5, 2022
1 parent 54f920e commit adde4aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/CustomCheckAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
}
}

0 comments on commit adde4aa

Please sign in to comment.