diff --git a/CHANGELOG.md b/CHANGELOG.md index 88dc807..0f9484e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Porter Changelog +## 1.0.6 - 2024-07-23 +### Fixed +- Magic link expiring in certain timezones (Thanks [@RobinWissink[](https://github.com/bymayo/craft-porter/issues/5)) + ## 1.0.5 - 2024-07-11 ### Fixed - If password field is blank when saving a user in the CP, skip password validation diff --git a/composer.json b/composer.json index f0f029d..058857e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "bymayo/porter", "description": "A toolkit with lots of helpers for users and accounts", "type": "craft-plugin", - "version": "1.0.5", + "version": "1.0.6", "keywords": [ "craft", "cms", diff --git a/src/services/MagicLink.php b/src/services/MagicLink.php index a9229a6..23584a3 100644 --- a/src/services/MagicLink.php +++ b/src/services/MagicLink.php @@ -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))