From: Tim Düsterhus Date: Tue, 26 Jul 2022 07:44:08 +0000 (+0200) Subject: Accept `\DateTimeInterface` in Totp X-Git-Tag: 6.0.0_Alpha_1~1106 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6b5d742e0ff54bb9636ee41f10628e0acd161631;p=GitHub%2FWoltLab%2FWCF.git Accept `\DateTimeInterface` in Totp --- diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/Totp.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/Totp.class.php index 1e4e7f7312..b0601684df 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/Totp.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/Totp.class.php @@ -72,7 +72,7 @@ final class Totp /** * Generates the TOTP code for the given timestamp. */ - public function generateTotpCode(\DateTime $time): string + public function generateTotpCode(\DateTimeInterface $time): string { $counter = \intval($time->getTimestamp() / self::TIME_STEP); @@ -85,7 +85,7 @@ final class Totp * If this method returns `true` the $minCounter value will be updated to the counter that * was used for verification. You MUST store the updated $minCounter to prevent code re-use. */ - public function validateTotpCode(string $userCode, int &$minCounter, \DateTime $time): bool + public function validateTotpCode(string $userCode, int &$minCounter, \DateTimeInterface $time): bool { $counter = \intval($time->getTimestamp() / self::TIME_STEP);