From d7cb86a7e2392c64e54fd918311586996bc01e77 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Wed, 22 Nov 2023 14:33:35 +0100 Subject: [PATCH] Remove 'two_factor_auth_configuring' after verify success Signed-off-by: Michiel de Jong --- lib/private/Authentication/TwoFactorAuth/Manager.php | 1 + tests/lib/Authentication/TwoFactorAuth/ManagerTest.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 0163c5fcc86a5..18f9c3d48bf46 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -263,6 +263,7 @@ public function verifyChallenge(string $providerId, IUser $user, string $challen $this->session->remove(self::SESSION_UID_KEY); $this->session->remove(self::REMEMBER_LOGIN); $this->session->set(self::SESSION_UID_DONE, $user->getUID()); + $this->session->remove(self::SESSION_UID_CONFIGURING); // Clear token from db $sessionId = $this->session->getId(); diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index 11602dc44fe93..ce324cc7ac55d 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -369,11 +369,12 @@ public function testVerifyChallenge() { ->method('get') ->with('two_factor_remember_login') ->willReturn(false); - $this->session->expects($this->exactly(2)) + $this->session->expects($this->exactly(3)) ->method('remove') ->withConsecutive( ['two_factor_auth_uid'], - ['two_factor_remember_login'] + ['two_factor_remember_login'], + ['two_factor_auth_configuring'] ); $this->session->expects($this->once()) ->method('set')