Пример #1
0
 /**
  * Check if current reset password link token is expired
  *
  * @return boolean
  */
 public function isResetPasswordLinkTokenExpired()
 {
     $linkToken = $this->getRpToken();
     $linkTokenCreatedAt = $this->getRpTokenCreatedAt();
     if (empty($linkToken) || empty($linkTokenCreatedAt)) {
         return true;
     }
     $expirationPeriod = $this->_customerData->getResetPasswordLinkExpirationPeriod();
     $currentTimestamp = $this->dateTime->toTimestamp($this->dateTime->now());
     $tokenTimestamp = $this->dateTime->toTimestamp($linkTokenCreatedAt);
     if ($tokenTimestamp > $currentTimestamp) {
         return true;
     }
     $dayDifference = floor(($currentTimestamp - $tokenTimestamp) / (24 * 60 * 60));
     if ($dayDifference >= $expirationPeriod) {
         return true;
     }
     return false;
 }