Fixed account tests

This commit is contained in:
Eldad Fux
2021-05-09 02:10:13 +03:00
parent 9f6988f5a0
commit dc57a41f36
3 changed files with 13 additions and 5 deletions
+9 -1
View File
@@ -484,6 +484,10 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
'registration' => \time(),
'reset' => false,
'name' => $name,
'prefs' => [],
'sessions' => [],
'tokens' => [],
'memberships' => [],
]));
} catch (Duplicate $th) {
throw new Exception('Account already exists', 409);
@@ -638,7 +642,11 @@ App::post('/v1/account/sessions/anonymous')
'passwordUpdate' => \time(),
'registration' => \time(),
'reset' => false,
'name' => null
'name' => null,
'prefs' => [],
'sessions' => [],
'tokens' => [],
'memberships' => [],
]));
} catch (Exception $th) {
throw new Exception('Failed saving user to DB', 500);
+2 -2
View File
@@ -485,8 +485,8 @@ App::setResource('user', function($mode, $project, $console, $request, $response
$user = $dbForInternal->getDocument('users', $jwtUserId);
}
if (empty($user->search('$id', $jwtSessionId, $user->getAttribute('tokens')))) { // Match JWT to active token
$user = new Document(['$id' => '', '$collection' => Database::SYSTEM_COLLECTION_USERS]);
if (empty($user->search('$id', $jwtSessionId, $user->getAttribute('sessions')))) { // Match JWT to active token
$user = new Document(['$id' => '', '$collection' => 'users']);
}
}
Generated
+2 -2
View File
@@ -1923,7 +1923,7 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database",
"reference": "11a149d2fd04b73c9fddffb93e96efc78d4a6039"
"reference": "20d189c6687ebfe82c3148794a01f51ebc6efb05"
},
"require": {
"ext-mongodb": "*",
@@ -1970,7 +1970,7 @@
"upf",
"utopia"
],
"time": "2021-05-06T20:03:31+00:00"
"time": "2021-05-08T22:11:07+00:00"
},
{
"name": "utopia-php/domains",