From d3e8e5ff217bab4b26627d9c06ac6e36cdef2075 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Fri, 4 Feb 2022 17:10:52 +0100 Subject: [PATCH] Fixed tests --- app/config/collections.php | 2 +- app/controllers/api/account.php | 4 ++++ app/controllers/api/teams.php | 1 + app/controllers/api/users.php | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/config/collections.php b/app/config/collections.php index ab3d9b69b9..86810d397f 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -989,7 +989,7 @@ $collections = [ 'format' => '', 'size' => 256, 'signed' => true, - 'required' => true, + 'required' => false, 'default' => 'bcrypt', 'array' => false, 'filters' => [], diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 9d7113b27e..b3bf8324d9 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -507,6 +507,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') 'emailVerification' => true, 'status' => true, // Email should already be authenticated by OAuth2 provider 'password' => Auth::passwordHash(Auth::passwordGenerator(), 'bcrypt'), + 'hash' => 'bcrypt', 'passwordUpdate' => 0, 'registration' => \time(), 'reset' => false, @@ -682,6 +683,7 @@ App::post('/v1/account/sessions/magic-url') 'emailVerification' => false, 'status' => true, 'password' => null, + 'hash' => 'bcrypt', 'passwordUpdate' => \time(), 'registration' => \time(), 'reset' => false, @@ -953,6 +955,7 @@ App::post('/v1/account/sessions/anonymous') 'emailVerification' => false, 'status' => true, 'password' => null, + 'hash' => 'bcrypt', 'passwordUpdate' => \time(), 'registration' => \time(), 'reset' => false, @@ -1451,6 +1454,7 @@ App::patch('/v1/account/email') try { $user = $dbForProject->updateDocument('users', $user->getId(), $user ->setAttribute('password', $isAnonymousUser ? Auth::passwordHash($password, $hash) : $user->getAttribute('password', '')) + ->setAttribute('hash', $isAnonymousUser ? $hash : $user->getAttribute('hash', '')) ->setAttribute('email', $email) ->setAttribute('emailVerification', false) // After this user needs to confirm mail again ->setAttribute('search', implode(' ', [$user->getId(), $user->getAttribute('name'), $user->getAttribute('email')])) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 810d11dae5..c7a711074c 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -325,6 +325,7 @@ App::post('/v1/teams/:teamId/memberships') 'emailVerification' => false, 'status' => true, 'password' => Auth::passwordHash(Auth::passwordGenerator(), 'bcrypt'), + 'hash' => 'bcrypt', /** * Set the password update time to 0 for users created using * team invite and OAuth to allow password updates without an diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 97993294d8..a023d735da 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -64,6 +64,7 @@ App::post('/v1/users') 'emailVerification' => false, 'status' => true, 'password' => $import ? $password : Auth::passwordHash($password, $hash), + 'hash' => $hash, 'passwordUpdate' => \time(), 'registration' => \time(), 'reset' => false,