From 10cf5a3855238b6fd1b15ffd96a0a3ed6db0c5e0 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 27 May 2025 10:10:29 +0200 Subject: [PATCH] Capture 2FA configuration in variable before returning it --- src/Auth.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index 2e431d1..94ff9a9 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1845,7 +1845,9 @@ final class Auth extends UserManager { public function prepareTwoFactorViaTotp($serviceName = null) { $serviceName = !empty($serviceName) ? (string) $serviceName : (!empty($_SERVER['SERVER_NAME']) ? (string) $_SERVER['SERVER_NAME'] : (string) $_SERVER['SERVER_ADDR']); - return $this->prepareTwoFactor(self::TWO_FACTOR_MECHANISM_TOTP, $serviceName, null); + $keyUriAndSecretString = $this->prepareTwoFactor(self::TWO_FACTOR_MECHANISM_TOTP, $serviceName, null); + + return $keyUriAndSecretString; } /** @@ -2033,7 +2035,9 @@ final class Auth extends UserManager { * @throws AuthError if an internal problem occurred (do *not* catch) */ public function enableTwoFactorViaTotp($otpValue) { - return $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_TOTP, $otpValue); + $recoveryCodes = $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_TOTP, $otpValue); + + return $recoveryCodes; } /** @@ -2053,7 +2057,9 @@ final class Auth extends UserManager { * @throws AuthError if an internal problem occurred (do *not* catch) */ public function enableTwoFactorViaSms($otpValue) { - return $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_SMS, $otpValue); + $recoveryCodes = $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_SMS, $otpValue); + + return $recoveryCodes; } /** @@ -2073,7 +2079,9 @@ final class Auth extends UserManager { * @throws AuthError if an internal problem occurred (do *not* catch) */ public function enableTwoFactorViaEmail($otpValue) { - return $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_EMAIL, $otpValue); + $recoveryCodes = $this->enableTwoFactor(self::TWO_FACTOR_MECHANISM_EMAIL, $otpValue); + + return $recoveryCodes; } /**