summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/TwoFactorAuth/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Authentication/TwoFactorAuth/Manager.php')
-rw-r--r--lib/private/Authentication/TwoFactorAuth/Manager.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php
index 56fca8a745c..ef95184aba7 100644
--- a/lib/private/Authentication/TwoFactorAuth/Manager.php
+++ b/lib/private/Authentication/TwoFactorAuth/Manager.php
@@ -31,6 +31,7 @@ use function array_diff;
use function array_filter;
use BadMethodCallException;
use Exception;
+use OC\Authentication\Exceptions\ExpiredTokenException;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Token\IProvider as TokenProvider;
use OCP\Activity\IManager;
@@ -364,4 +365,12 @@ class Manager {
$this->config->setUserValue($user->getUID(), 'login_token_2fa', $token->getId(), $this->timeFactory->getTime());
}
+ public function clearTwoFactorPending(string $userId) {
+ $tokensNeeding2FA = $this->config->getUserKeys($userId, 'login_token_2fa');
+
+ foreach ($tokensNeeding2FA as $tokenId) {
+ $this->tokenProvider->invalidateTokenById($userId, $tokenId);
+ }
+ }
+
}