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

Return error when the user isn't attached to a company

This commit is contained in:
David Bomba 2021-05-11 14:57:36 +10:00
parent 3fca12f970
commit 3b01190bc2

View File

@ -207,6 +207,9 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
if(!$cu->exists())
return response()->json(['message' => 'User not linked to any companies'], 403);
$cu->first()->account->companies->each(function ($company) use($cu, $request){
if($company->tokens()->where('is_system', true)->count() == 0)