mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for dissociated default_company
This commit is contained in:
parent
8939860af6
commit
28e3defc83
@ -201,6 +201,14 @@ class LoginController extends BaseController
|
||||
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
||||
}
|
||||
|
||||
/* If for some reason we lose state on the default company ie. a company is deleted - always make sure we can default to a company*/
|
||||
if(!$user->account->default_company){
|
||||
$account = $user->account;
|
||||
$account->default_company_id = $user->companies->first()->id;
|
||||
$account->save();
|
||||
$user = $user->fresh();
|
||||
}
|
||||
|
||||
$user->setCompany($user->account->default_company);
|
||||
|
||||
$this->setLoginCache($user);
|
||||
|
Loading…
Reference in New Issue
Block a user