1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

Allow existing session when upgrading from anonymous to oauth

This commit is contained in:
Jake Barnby 2024-02-25 03:04:35 +13:00
parent 4190a09333
commit a178dbfc4b
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -558,7 +558,11 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->inject('queueForEvents')
->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Reader $geodb, Event $queueForEvents) use ($oauthDefaultSuccess) {
if (!$user->isEmpty()) {
throw new Exception(Exception::USER_SESSION_ALREADY_EXISTS);
$current = $user->find('current', true, 'sessions');
if ($current && $current->getAttribute('provider') !== Auth::SESSION_PROVIDER_ANONYMOUS) {
throw new Exception(Exception::USER_SESSION_ALREADY_EXISTS);
}
}
$protocol = $request->getProtocol();