1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-04 15:17:28 +02:00

Implement method 'Auth#isWaitingForSecondFactor'

This commit is contained in:
Marco
2024-04-04 19:01:43 +02:00
parent 4d92ca24c2
commit 68f5b23fc5

View File

@@ -2192,6 +2192,15 @@ final class Auth extends UserManager {
return $this->ipAddress; return $this->ipAddress;
} }
/**
* Returns whether we are waiting for the user to complete the second factor of (two-factor) authentification, them having successfully completed the first factor before
*
* @return bool
*/
public function isWaitingForSecondFactor() {
return !empty($_SESSION[self::SESSION_FIELD_AWAITING_2FA_UNTIL]) && $_SESSION[self::SESSION_FIELD_AWAITING_2FA_UNTIL] >= \time();
}
/** /**
* Performs throttling or rate limiting using the token bucket algorithm (inverse leaky bucket algorithm) * Performs throttling or rate limiting using the token bucket algorithm (inverse leaky bucket algorithm)
* *