diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-22 14:09:37 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-22 14:09:37 +0100 |
commit | 99d525eb36d8e3e14dbf72f5fb66b8554dce357c (patch) | |
tree | 28ff363dba6e0e54d8fe3c2c46457fcee8a8ca85 /lib | |
parent | b28cea626857a6ffa458558c9e45d451ac6ec9a2 (diff) | |
download | nextcloud-server-99d525eb36d8e3e14dbf72f5fb66b8554dce357c.tar.gz nextcloud-server-99d525eb36d8e3e14dbf72f5fb66b8554dce357c.zip |
Convert 2FA token type to string
The IConfig service is documented to handle its data as strings, hence
this changes the code a bit to ensure we store keys as string and
convert them back when reading.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 0a60606ad65..d95cc8b1ebf 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -339,7 +339,7 @@ class Manager { $tokenId = $token->getId(); $tokensNeeding2FA = $this->config->getUserKeys($user->getUID(), 'login_token_2fa'); - if (!\in_array($tokenId, $tokensNeeding2FA, true)) { + if (!\in_array((string) $tokenId, $tokensNeeding2FA, true)) { $this->session->set(self::SESSION_UID_DONE, $user->getUID()); return false; } @@ -376,14 +376,14 @@ class Manager { $id = $this->session->getId(); $token = $this->tokenProvider->getToken($id); - $this->config->setUserValue($user->getUID(), 'login_token_2fa', $token->getId(), $this->timeFactory->getTime()); + $this->config->setUserValue($user->getUID(), 'login_token_2fa', (string) $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); + $this->tokenProvider->invalidateTokenById($userId, (int)$tokenId); } } } |