1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Prevent connected accounts being linked to existing users

This commit is contained in:
David Bomba 2021-07-27 08:33:44 +10:00
parent 8bec600fdf
commit bc5b9ca2e6

View File

@ -104,8 +104,13 @@ class ConnectedAccountController extends BaseController
$refresh_token = '';
$token = '';
$email = $google->harvestEmail($user);
if(auth()->user()->email != $email && MultiDB::checkUserEmailExists($email))
return response()->json(['message' => ctrans('texts.email_already_register')], 400)
$connected_account = [
'email' => $google->harvestEmail($user),
'email' => $email,
'oauth_user_id' => $google->harvestSubField($user),
'oauth_provider_id' => 'google',
'email_verified_at' =>now()