Skip to content

Commit

Permalink
merge with remote master
Browse files Browse the repository at this point in the history
  • Loading branch information
gmponos committed Jun 26, 2018
2 parents 473a78e + 11706ac commit ab2b739
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- Change the minimum required version of guzzle from `^6.2` to `6.*`
- Fixed the alias version in composer.

## v0.3.0 - 2017-09-15
## v0.3.0 - 2017-09-14

### Bug
- Function that was calculating the timeout token if it was valid was wrong.
Expand Down
5 changes: 2 additions & 3 deletions src/Token/TimeoutToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ public function __construct($token, EncoderInterface $encoder = null, $offset =
public function isValid()
{
$payload = $this->getPayload();

if (isset($payload['exp'])) {
$now = new \DateTime('now');

if (is_int($payload['exp'])) {
return ($now->getTimestamp() - $payload['exp'] - $this->offset) > 0;
return ($payload['exp'] - $this->offset - $now->getTimestamp()) > 0;
}

if (is_numeric($payload['exp'])) {
return ($now->format('U') - $payload['exp'] - $this->offset) > 0;
return ($payload['exp'] - $this->offset - $now->format('U')) > 0;
}
}

Expand Down

0 comments on commit ab2b739

Please sign in to comment.