diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 90a35ede78..6190cec905 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -123,7 +123,8 @@ $createSession = function (string $userId, string $secret, Request $request, Res Authorization::skip(fn () => $dbForProject->deleteDocument('tokens', $verifiedToken->getId())); $dbForProject->purgeCachedDocument('users', $user->getId()); - if ($verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_MAGIC_URL) { + // Magic URL + Email OTP + if ($verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_MAGIC_URL || $verifiedToken->getAttribute('type') === Auth::TOKEN_TYPE_EMAIL) { $user->setAttribute('emailVerification', true); } diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index d61f44ca1b..2d72625121 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -202,6 +202,8 @@ trait AccountBase $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals($userId, $response['body']['$id']); + $this->assertEquals($userId, $response['body']['$id']); + $this->assertTrue($response['body']['emailVerification']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/token', array_merge([ 'origin' => 'http://localhost',