Merge pull request #1166 from TorstenDittmann/fix-anon-session-id
fix(account): add anon session id
This commit is contained in:
commit
3472b1545e
|
@ -714,10 +714,16 @@ App::post('/v1/account/sessions/anonymous')
|
||||||
$detector->getDevice()
|
$detector->getDevice()
|
||||||
));
|
));
|
||||||
|
|
||||||
$user->setAttribute('sessions', $session, Document::SET_TYPE_APPEND);
|
|
||||||
|
|
||||||
Authorization::setRole('user:'.$user->getId());
|
Authorization::setRole('user:'.$user->getId());
|
||||||
|
|
||||||
|
$session = $projectDB->createDocument($session->getArrayCopy());
|
||||||
|
|
||||||
|
if (false === $session) {
|
||||||
|
throw new Exception('Failed saving session to DB', 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->setAttribute('sessions', $session, Document::SET_TYPE_APPEND);
|
||||||
|
|
||||||
$user = $projectDB->updateDocument($user->getArrayCopy());
|
$user = $projectDB->updateDocument($user->getArrayCopy());
|
||||||
|
|
||||||
if (false === $user) {
|
if (false === $user) {
|
||||||
|
|
|
@ -240,6 +240,10 @@ class AccountCustomClientTest extends Scope
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals(201, $response['headers']['status-code']);
|
$this->assertEquals(201, $response['headers']['status-code']);
|
||||||
|
$this->assertIsArray($response['body']);
|
||||||
|
$this->assertNotEmpty($response['body']);
|
||||||
|
$this->assertNotEmpty($response['body']['$id']);
|
||||||
|
$this->assertNotEmpty($response['body']['userId']);
|
||||||
|
|
||||||
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
|
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue