From 58ba41a9c5d89af0d310d0cc1f0598c4079acb41 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 11 Apr 2023 19:36:14 +1200 Subject: [PATCH 1/2] Make password, hash and hashOptions optional so that they are optional in SDKs, and nulled when returning from the account service --- src/Appwrite/Utopia/Response/Model/User.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Model/User.php b/src/Appwrite/Utopia/Response/Model/User.php index 11a9bbf3a5..648b1c5dce 100644 --- a/src/Appwrite/Utopia/Response/Model/User.php +++ b/src/Appwrite/Utopia/Response/Model/User.php @@ -38,12 +38,14 @@ class User extends Model ->addRule('password', [ 'type' => self::TYPE_STRING, 'description' => 'Hashed user password.', + 'required' => false, 'default' => '', 'example' => '$argon2id$v=19$m=2048,t=4,p=3$aUZjLnliVWRINmFNTWMudg$5S+x+7uA31xFnrHFT47yFwcJeaP0w92L/4LdgrVRXxE', ]) ->addRule('hash', [ 'type' => self::TYPE_STRING, 'description' => 'Password hashing algorithm.', + 'required' => false, 'default' => '', 'example' => 'argon2', ]) @@ -58,6 +60,7 @@ class User extends Model Response::MODEL_ALGO_MD5, // keep least secure at the bottom. this order will be used in docs ], 'description' => 'Password hashing algorithm configuration.', + 'required' => false, 'default' => [], 'example' => new \stdClass(), 'array' => false, From 5cbb08d6f109105ad543d06adc51fc29d4b9a23a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 11 Apr 2023 20:41:24 +1200 Subject: [PATCH 2/2] Fix response model types for update password + update status --- app/controllers/api/account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index d48423271c..11d67232c7 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1557,7 +1557,7 @@ App::patch('/v1/account/password') ->label('sdk.description', '/docs/references/account/update-password.md') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) - ->label('sdk.response.model', Response::MODEL_ACCOUNT) + ->label('sdk.response.model', Response::MODEL_USER) ->label('sdk.offline.model', '/account') ->label('sdk.offline.key', 'current') ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) @@ -1761,7 +1761,7 @@ App::patch('/v1/account/status') ->label('sdk.description', '/docs/references/account/update-status.md') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) - ->label('sdk.response.model', Response::MODEL_ACCOUNT) + ->label('sdk.response.model', Response::MODEL_USER) ->inject('requestTimestamp') ->inject('response') ->inject('user')