mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Merge branch '1.8.x' into copilot/fix-3b5374b7-acb3-4c22-9573-00c1feec5bc1
This commit is contained in:
commit
0c64eaf441
3 changed files with 39 additions and 0 deletions
|
|
@ -211,6 +211,11 @@ return [
|
|||
'description' => 'User with the requested ID could not be found.',
|
||||
'code' => 404,
|
||||
],
|
||||
Exception::USER_EMAIL_NOT_FOUND => [
|
||||
'name' => Exception::USER_EMAIL_NOT_FOUND,
|
||||
'description' => 'User email could not be found.',
|
||||
'code' => 400,
|
||||
],
|
||||
Exception::USER_EMAIL_ALREADY_EXISTS => [
|
||||
'name' => Exception::USER_EMAIL_ALREADY_EXISTS,
|
||||
'description' => 'A user with the same email already exists in the current project.',
|
||||
|
|
@ -312,11 +317,21 @@ return [
|
|||
'description' => 'OAuth2 provider returned some error.',
|
||||
'code' => 424,
|
||||
],
|
||||
Exception::USER_EMAIL_NOT_VERIFIED => [
|
||||
'name' => Exception::USER_EMAIL_NOT_VERIFIED,
|
||||
'description' => 'User email is not verified',
|
||||
'code' => 400,
|
||||
],
|
||||
Exception::USER_EMAIL_ALREADY_VERIFIED => [
|
||||
'name' => Exception::USER_EMAIL_ALREADY_VERIFIED,
|
||||
'description' => 'User email is already verified',
|
||||
'code' => 409,
|
||||
],
|
||||
Exception::USER_PHONE_NOT_VERIFIED => [
|
||||
'name' => Exception::USER_PHONE_NOT_VERIFIED,
|
||||
'description' => 'User phone is not verified',
|
||||
'code' => 400,
|
||||
],
|
||||
Exception::USER_PHONE_ALREADY_VERIFIED => [
|
||||
'name' => Exception::USER_PHONE_ALREADY_VERIFIED,
|
||||
'description' => 'User phone is already verified',
|
||||
|
|
|
|||
|
|
@ -3595,6 +3595,10 @@ App::post('/v1/account/verifications/email')
|
|||
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP Disabled');
|
||||
}
|
||||
|
||||
if (empty($user->getAttribute('email'))) {
|
||||
throw new Exception(Exception::USER_EMAIL_NOT_FOUND);
|
||||
}
|
||||
|
||||
$url = htmlentities($url);
|
||||
if ($user->getAttribute('emailVerification')) {
|
||||
throw new Exception(Exception::USER_EMAIL_ALREADY_VERIFIED);
|
||||
|
|
|
|||
|
|
@ -1921,6 +1921,26 @@ class AccountCustomClientTest extends Scope
|
|||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAnonymousAccount
|
||||
*/
|
||||
public function testCreateAnonymousAccountVerification($session): array
|
||||
{
|
||||
$response = $this->client->call(Client::METHOD_POST, '/account/verification', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]), [
|
||||
'url' => 'http://localhost/verification',
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $response['body']['code']);
|
||||
$this->assertEquals('user_email_not_found', $response['body']['type']);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateAnonymousAccount
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue