From ceac62c3f31f7eee5cd591a1e8ba8c7f01356798 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 16 Aug 2024 07:02:38 +0200 Subject: [PATCH] Swap order of arguments for 'addSmsOption' and 'addEmailOption' --- src/Auth.php | 4 ++-- src/SecondFactorRequiredException.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index be3b3d3..b7ef68d 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1321,10 +1321,10 @@ final class Auth extends UserManager { $otpValue = $this->generateAndStoreRandomOneTimePassword($userId, $twoFactorMethod['mechanism']); if (((int) $twoFactorMethod['mechanism']) === self::TWO_FACTOR_MECHANISM_SMS) { - $secondFactorRequiredException->addSmsOption($twoFactorMethod['seed'], $otpValue); + $secondFactorRequiredException->addSmsOption($otpValue, $twoFactorMethod['seed']); } elseif (((int) $twoFactorMethod['mechanism']) === self::TWO_FACTOR_MECHANISM_EMAIL) { - $secondFactorRequiredException->addEmailOption($twoFactorMethod['seed'], $otpValue); + $secondFactorRequiredException->addEmailOption($otpValue, $twoFactorMethod['seed']); } else { throw new InvalidStateError(); diff --git a/src/SecondFactorRequiredException.php b/src/SecondFactorRequiredException.php index 4ed17e2..baca303 100644 --- a/src/SecondFactorRequiredException.php +++ b/src/SecondFactorRequiredException.php @@ -49,14 +49,14 @@ class SecondFactorRequiredException extends AuthException { $this->totp = true; } - public function addSmsOption($recipient, $otpValue) { - $this->smsRecipient = !empty($recipient) ? (string) $recipient : null; + public function addSmsOption($otpValue, $recipient) { $this->smsOtpValue = !empty($otpValue) ? (string) $otpValue : null; + $this->smsRecipient = !empty($recipient) ? (string) $recipient : null; } - public function addEmailOption($recipient, $otpValue) { - $this->emailRecipient = !empty($recipient) ? (string) $recipient : null; + public function addEmailOption($otpValue, $recipient) { $this->emailOtpValue = !empty($otpValue) ? (string) $otpValue : null; + $this->emailRecipient = !empty($recipient) ? (string) $recipient : null; } }