From 153a57ed831b3aac2fdb57527359905e53fbc260 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 26 Jul 2022 09:44:50 +0200 Subject: [PATCH] Pass `\DateTimeImmutable` to Totp in TotpMultifactorMethod --- .../system/user/multifactor/TotpMultifactorMethod.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php index 44502f2608..777fb9d28f 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php @@ -84,7 +84,7 @@ final class TotpMultifactorMethod implements IMultifactorMethod $totp = $secret->getTotp(); $minCounter = 0; - if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTime())) { + if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTimeImmutable())) { $field->value(''); $field->addValidationError(new FormFieldValidationError( 'invalidCode', @@ -338,7 +338,7 @@ final class TotpMultifactorMethod implements IMultifactorMethod $totp = new Totp($selectedDevice['secret']); $minCounter = $selectedDevice['minCounter']; - if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTime())) { + if (!$totp->validateTotpCode($field->getValue(), $minCounter, new \DateTimeImmutable())) { $field->value(''); $field->addValidationError(new FormFieldValidationError( 'invalidCode', -- 2.20.1