From 2f3cd843626b9e1a6c6da7f26609d6e6fb79513e Mon Sep 17 00:00:00 2001 From: Jason Mayo Date: Tue, 23 Jul 2024 16:12:56 +0100 Subject: [PATCH] Magic link expiring in certain timezones --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/services/MagicLink.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85718a7..7007581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index 3d00699..b35bf5b 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": "5.0.2", + "version": "5.0.3", "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))