mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
feat: expose email metadata fields in user response model
This commit is contained in:
1 parent
4a7d47d2cc
commit
77c50c5910
3 files changed
+55
-5
No files matched your search
@@ -108,6 +108,41 @@ class User extends Model
|
||||
'default' => false,
|
||||
'example' => true,
|
||||
])
|
||||
->addRule('emailCanonical', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Canonical form of the user email address.',
|
||||
'required' => false,
|
||||
'default' => '',
|
||||
'example' => 'john@appwrite.io',
|
||||
])
|
||||
->addRule('emailIsFree', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the user email is from a free email provider.',
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'example' => true,
|
||||
])
|
||||
->addRule('emailIsDisposable', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the user email is from a disposable email provider.',
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'example' => false,
|
||||
])
|
||||
->addRule('emailIsCorporate', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the user email is from a corporate domain.',
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'example' => false,
|
||||
])
|
||||
->addRule('emailIsCanonical', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the user email is in its canonical form.',
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'example' => true,
|
||||
])
|
||||
->addRule('phoneVerification', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Phone verification status.',
|
||||
|
||||
@@ -43,11 +43,11 @@ trait AccountBase
|
||||
$this->assertNotEmpty($response['body']['accessedAt']);
|
||||
$this->assertArrayHasKey('targets', $response['body']);
|
||||
$this->assertEquals($email, $response['body']['targets'][0]['identifier']);
|
||||
$this->assertArrayNotHasKey('emailCanonical', $response['body']);
|
||||
$this->assertArrayNotHasKey('emailIsFree', $response['body']);
|
||||
$this->assertArrayNotHasKey('emailIsDisposable', $response['body']);
|
||||
$this->assertArrayNotHasKey('emailIsCorporate', $response['body']);
|
||||
$this->assertArrayNotHasKey('emailIsCanonical', $response['body']);
|
||||
$this->assertArrayHasKey('emailCanonical', $response['body']);
|
||||
$this->assertArrayHasKey('emailIsFree', $response['body']);
|
||||
$this->assertArrayHasKey('emailIsDisposable', $response['body']);
|
||||
$this->assertArrayHasKey('emailIsCorporate', $response['body']);
|
||||
$this->assertArrayHasKey('emailIsCanonical', $response['body']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
||||
@@ -337,6 +337,11 @@ trait UsersBase
|
||||
$this->assertEquals($body['status'], true);
|
||||
$this->assertGreaterThan('2000-01-01 00:00:00', $body['registration']);
|
||||
$this->assertEquals($body['labels'], []);
|
||||
$this->assertArrayHasKey('emailCanonical', $body);
|
||||
$this->assertArrayHasKey('emailIsFree', $body);
|
||||
$this->assertArrayHasKey('emailIsDisposable', $body);
|
||||
$this->assertArrayHasKey('emailIsCorporate', $body);
|
||||
$this->assertArrayHasKey('emailIsCanonical', $body);
|
||||
|
||||
/**
|
||||
* Test Create with Custom ID for SUCCESS
|
||||
@@ -751,6 +756,11 @@ trait UsersBase
|
||||
}
|
||||
}
|
||||
$this->assertNotNull($user1, 'user1 should exist in user list');
|
||||
$this->assertArrayHasKey('emailCanonical', $user1);
|
||||
$this->assertArrayHasKey('emailIsFree', $user1);
|
||||
$this->assertArrayHasKey('emailIsDisposable', $user1);
|
||||
$this->assertArrayHasKey('emailIsCorporate', $user1);
|
||||
$this->assertArrayHasKey('emailIsCanonical', $user1);
|
||||
|
||||
// This test ensures that by default, endpoints dont support select queries
|
||||
// If we add select query to this endpoint, you will need to remove this test
|
||||
@@ -1092,6 +1102,11 @@ trait UsersBase
|
||||
$this->assertNotEmpty($user['body']['email']);
|
||||
$this->assertEquals($user['body']['status'], true);
|
||||
$this->assertGreaterThan('2000-01-01 00:00:00', $user['body']['registration']);
|
||||
$this->assertArrayHasKey('emailCanonical', $user['body']);
|
||||
$this->assertArrayHasKey('emailIsFree', $user['body']);
|
||||
$this->assertArrayHasKey('emailIsDisposable', $user['body']);
|
||||
$this->assertArrayHasKey('emailIsCorporate', $user['body']);
|
||||
$this->assertArrayHasKey('emailIsCanonical', $user['body']);
|
||||
|
||||
$sessions = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/sessions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
||||
Reference in new issue
Block a user