Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Reverted change for time compression to use \Magento\Framework\Stdlib…
Browse files Browse the repository at this point in the history
…\DateTime::strToTime instead of php strtotime.

Updated helpers to get token expire time to check  if value is positive before response.
  • Loading branch information
ivanko-dev committed Oct 2, 2019
1 parent 0bda8d0 commit fc5ff12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Integration/Helper/Oauth/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getConsumerPostTimeout()
public function getCustomerTokenLifetime()
{
$hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/customer');
return is_numeric($hours) ? $hours : 0;
return is_numeric($hours) && $hours > 0 ? $hours : 0;
}

/**
Expand All @@ -132,6 +132,6 @@ public function getCustomerTokenLifetime()
public function getAdminTokenLifetime()
{
$hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/admin');
return is_numeric($hours) ? $hours : 0;
return is_numeric($hours) && $hours > 0 ? $hours : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function isTokenExpired(Token $token): bool
return false;
}

if (strtotime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
return true;
}

Expand Down

0 comments on commit fc5ff12

Please sign in to comment.