From c6b201a9dae102575fbfd8b281586f74178f9435 Mon Sep 17 00:00:00 2001 From: Tom Fortmuller Date: Fri, 23 Feb 2024 15:17:17 -0500 Subject: [PATCH 1/2] Update BreezyCore.php Add check to shouldForceTwoFactor() to check for required email verification. --- src/BreezyCore.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BreezyCore.php b/src/BreezyCore.php index 3224a9c..8f881e7 100644 --- a/src/BreezyCore.php +++ b/src/BreezyCore.php @@ -319,6 +319,10 @@ public function verify(string $code, ?Authenticatable $user = null) public function shouldForceTwoFactor(): bool { + if ($this->getCurrentPanel()->isEmailVerificationRequired()) { + return $this->forceTwoFactorAuthentication && !$this->auth()->user()?->hasConfirmedTwoFactor() && $this->auth()->user()?->hasVerifiedEmail(); + } + return $this->forceTwoFactorAuthentication && ! $this->auth()->user()?->hasConfirmedTwoFactor(); } From bace9def2072ab6f305cc6c2cbd10ca0d1c87c54 Mon Sep 17 00:00:00 2001 From: tomfortmuller Date: Fri, 23 Feb 2024 20:44:12 +0000 Subject: [PATCH 2/2] Fix styling --- src/BreezyCore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BreezyCore.php b/src/BreezyCore.php index 8f881e7..476212e 100644 --- a/src/BreezyCore.php +++ b/src/BreezyCore.php @@ -320,7 +320,7 @@ public function verify(string $code, ?Authenticatable $user = null) public function shouldForceTwoFactor(): bool { if ($this->getCurrentPanel()->isEmailVerificationRequired()) { - return $this->forceTwoFactorAuthentication && !$this->auth()->user()?->hasConfirmedTwoFactor() && $this->auth()->user()?->hasVerifiedEmail(); + return $this->forceTwoFactorAuthentication && ! $this->auth()->user()?->hasConfirmedTwoFactor() && $this->auth()->user()?->hasVerifiedEmail(); } return $this->forceTwoFactorAuthentication && ! $this->auth()->user()?->hasConfirmedTwoFactor();