Skip to content

Commit

Permalink
Magic link expiring in certain timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
bymayo committed Jul 23, 2024
1 parent fc581cc commit 2f3cd84
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Porter Changelog

## 5.0.3 - 2024-07-23
### Fixed
- Magic link expiring in certain timezones (Thanks [@RobinWissink[](https://github.com/bymayo/craft-porter/issues/5))

## 5.0.2 - 2024-07-11
### Fixed
- If password field is blank when saving a user in the CP, skip password validation
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bymayo/porter",
"description": "A toolkit with lots of helpers for users and accounts",
"type": "craft-plugin",
"version": "5.0.2",
"version": "5.0.3",
"keywords": [
"craft",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion src/services/MagicLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function validateToken($token)

$this->invalidateTokens($user);

if (DateTimeHelper::currentTimeStamp() <= (strtotime($query->dateCreated) + $this->settings->magicLinkExpirySeconds))
if (DateTimeHelper::currentTimeStamp() <= (DateTimeHelper::toDateTime($query->dateCreated)->format('U') + $this->settings->magicLinkExpirySeconds))
{

if (Craft::$app->getUser()->login($user))
Expand Down

0 comments on commit 2f3cd84

Please sign in to comment.