From ff5c5c7138ecec10afa3641508bf73e7f15f8c50 Mon Sep 17 00:00:00 2001 From: munyoudoum Date: Wed, 11 Jan 2023 13:33:55 +0700 Subject: [PATCH 1/3] fix(api/account): formatTz for expire property in POST email sessions --- app/controllers/api/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index fe189741a1..1518e00887 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -188,7 +188,7 @@ App::post('/v1/account/sessions/email') $detector = new Detector($request->getUserAgent('UNKNOWN')); $record = $geodb->get($request->getIP()); - $expire = DateTime::addSeconds(new \DateTime(), $duration); + $expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration)); $secret = Auth::tokenGenerator(); $session = new Document(array_merge( [ From 63b54ead6266ffaa250661aabff0d4a5ef7fe877 Mon Sep 17 00:00:00 2001 From: munyoudoum Date: Wed, 11 Jan 2023 14:00:09 +0700 Subject: [PATCH 2/3] chore(tests): assert expire key has formatTz in POST email session --- tests/e2e/Services/Account/AccountBase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index e8bf146316..6f45ab6c74 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -119,6 +119,7 @@ trait AccountBase ]); $this->assertEquals($response['headers']['status-code'], 201); + $this->assertNotFalse(\DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $response['body']['expire'])); $sessionId = $response['body']['$id']; $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']]; @@ -133,6 +134,7 @@ trait AccountBase ]); $this->assertEquals($response['headers']['status-code'], 201); + $this->assertNotFalse(\DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $response['body']['expire'])); /** * Test for FAILURE From 9890b5934dd9f6f8fea9c80eba6fa61feb92dc03 Mon Sep 17 00:00:00 2001 From: munyoudoum Date: Mon, 30 Jan 2023 00:43:46 +0700 Subject: [PATCH 3/3] chore: update changes.md --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 66d4ec1891..79143b5589 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +- Fix expire to formatTz in create account session [#4985](https://github.com/appwrite/appwrite/pull/4985) + # Version 1.2.1 ## Features