1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-03 22:57:27 +02:00

Swap order of arguments for 'addSmsOption' and 'addEmailOption'

This commit is contained in:
Marco
2024-08-16 07:02:38 +02:00
parent e5ccc81988
commit ceac62c3f3
2 changed files with 6 additions and 6 deletions

View File

@@ -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();

View File

@@ -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;
}
}