Skip to content

Commit

Permalink
バージョンで分岐
Browse files Browse the repository at this point in the history
  • Loading branch information
chihiro-adachi committed Mar 19, 2024
1 parent 903938b commit 58956a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Controller/CustomerPersonalValidationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Plugin\TwoFactorAuthCustomer42\Controller;

use Eccube\Common\Constant;
use Eccube\Controller\AbstractController;
use Eccube\Entity\Customer;
use Eccube\Repository\CustomerRepository;
Expand Down Expand Up @@ -237,10 +238,16 @@ private function checkDeviceToken($Customer, $token): bool
$now = new \DateTime();

// フォームからのハッシュしたワンタイムパスワードとDBに保存しているワンタイムパスワードのハッシュは一致しているかどうか
if (
if (version_compare(Constant::VERSION, '4.3', '>=') &&
!$this->customerTwoFactorAuthService->veriyOneTimeToken($Customer->getDeviceAuthOneTimeToken(), $token) ||
$Customer->getDeviceAuthOneTimeTokenExpire() < $now) {
return false;
} else {
if (
$Customer->getDeviceAuthOneTimeToken() !== $this->customerTwoFactorAuthService->hashOneTimeToken($token) ||
$Customer->getDeviceAuthOneTimeTokenExpire() < $now) {
return false;
}
}

return true;
Expand Down

0 comments on commit 58956a6

Please sign in to comment.