mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:17:32 -05:00 
			
		
		
		
	Merge pull request #5662 from turbo124/v5-develop
Return error when the user isn't attached to a company
This commit is contained in:
		
						commit
						4ccf6fcbcc
					
				@ -207,6 +207,9 @@ class LoginController extends BaseController
 | 
				
			|||||||
            $cu = CompanyUser::query()
 | 
					            $cu = CompanyUser::query()
 | 
				
			||||||
                  ->where('user_id', auth()->user()->id);
 | 
					                  ->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){
 | 
					            $cu->first()->account->companies->each(function ($company) use($cu, $request){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if($company->tokens()->where('is_system', true)->count() == 0)
 | 
					                if($company->tokens()->where('is_system', true)->count() == 0)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user