From b817e45e8b20e59947e08c33d1ec4f560d6aa9c7 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 --- 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 3e71d0787b313..ffe34991c9bf0 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -276,6 +276,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 c9e09767f8087..4e8ee7a9d3673 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -375,11 +375,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')