Merge branch '1.5.x' into feat-migrate-cloud-templates

This commit is contained in:
Khushboo Verma
2024-01-13 00:54:49 +05:30
11 changed files with 9 additions and 32 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -6
View File
@@ -2774,17 +2774,12 @@ App::put('/v1/account/recovery')
->param('userId', '', new UID(), 'User ID.')
->param('secret', '', new Text(256), 'Valid reset token.')
->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary'])
->param('passwordAgain', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'Repeat new user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary'])
->inject('response')
->inject('user')
->inject('dbForProject')
->inject('project')
->inject('queueForEvents')
->action(function (string $userId, string $secret, string $password, string $passwordAgain, Response $response, Document $user, Database $dbForProject, Document $project, Event $queueForEvents) {
if ($password !== $passwordAgain) {
throw new Exception(Exception::USER_PASSWORD_MISMATCH);
}
->action(function (string $userId, string $secret, string $password, Response $response, Document $user, Database $dbForProject, Document $project, Event $queueForEvents) {
$profile = $dbForProject->getDocument('users', $userId);
if ($profile->isEmpty()) {
@@ -1283,7 +1283,6 @@ trait AccountBase
'userId' => $id,
'secret' => $recovery,
'password' => $newPassowrd,
'passwordAgain' => $newPassowrd,
]);
$this->assertEquals(200, $response['headers']['status-code']);
@@ -1299,7 +1298,6 @@ trait AccountBase
'userId' => ID::custom('ewewe'),
'secret' => $recovery,
'password' => $newPassowrd,
'passwordAgain' => $newPassowrd,
]);
$this->assertEquals(404, $response['headers']['status-code']);
@@ -1312,24 +1310,10 @@ trait AccountBase
'userId' => $id,
'secret' => 'sdasdasdasd',
'password' => $newPassowrd,
'passwordAgain' => $newPassowrd,
]);
$this->assertEquals(401, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_PUT, '/account/recovery', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]), [
'userId' => $id,
'secret' => $recovery,
'password' => $newPassowrd . 'x',
'passwordAgain' => $newPassowrd,
]);
$this->assertEquals(400, $response['headers']['status-code']);
return $data;
}
+2 -2
View File
@@ -1271,8 +1271,8 @@ trait Base
}
}';
case self::$UPDATE_PASSWORD_RECOVERY:
return 'mutation confirmPasswordRecovery($userId: String!, $secret: String!, $password: String!, $passwordAgain: String!) {
accountUpdateRecovery(userId: $userId, secret: $secret, password: $password, passwordAgain: $passwordAgain) {
return 'mutation confirmPasswordRecovery($userId: String!, $secret: String!, $password: String!) {
accountUpdateRecovery(userId: $userId, secret: $secret, password: $password) {
userId
secret
expire
@@ -617,7 +617,6 @@ class RealtimeCustomClientTest extends Scope
'userId' => $userId,
'secret' => $recovery,
'password' => 'test-recovery',
'passwordAgain' => 'test-recovery',
]);
$response = json_decode($client->receive(), true);
@@ -824,7 +824,6 @@ class WebhooksCustomClientTest extends Scope
'userId' => $id,
'secret' => $secret,
'password' => $password,
'passwordAgain' => $password,
]);
$recoveryId = $recovery['body']['$id'];