diff --git a/CHANGES.md b/CHANGES.md index ff0ef8f145..1e7ab9acbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,5 @@ # Version TBD +- Fix expire to formatTz in create account session [#4985](https://github.com/appwrite/appwrite/pull/4985) - Fix not storing function's response on response codes 5xx [#4610](https://github.com/appwrite/appwrite/pull/4610) # Version 1.2.1 diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 6b1d11167a..ae3b30479a 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( [ diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 5b5c1ccc12..785b2af097 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -121,6 +121,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']]; @@ -135,6 +136,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