mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 03:24:35 -04:00
Fixes around oauth google login
This commit is contained in:
parent
b4f2bba053
commit
15a85da085
@ -388,13 +388,12 @@ class LoginController extends BaseController
|
|||||||
$cu = CompanyUser::query()
|
$cu = CompanyUser::query()
|
||||||
->where('user_id', auth()->user()->id);
|
->where('user_id', auth()->user()->id);
|
||||||
|
|
||||||
// $cu->first()->account->companies->each(function ($company) use($cu){
|
|
||||||
|
|
||||||
// if($company->tokens()->where('is_system', true)->count() == 0)
|
$truth = app()->make(TruthSource::class);
|
||||||
// {
|
|
||||||
// CreateCompanyToken::dispatchNow($company, $cu->first()->user, request()->server('HTTP_USER_AGENT'));
|
$truth->setCompanyUser($cu->first());
|
||||||
// }
|
$truth->setUser(auth()->user());
|
||||||
// });
|
$truth->setCompany(auth()->user()->account->default_company);
|
||||||
|
|
||||||
|
|
||||||
if($existing_user->company_users()->count() != $existing_user->tokens()->count())
|
if($existing_user->company_users()->count() != $existing_user->tokens()->count())
|
||||||
|
@ -156,6 +156,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();
|
return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($truth->getCompany())
|
||||||
|
return $this->tokens()->where('company_id', $truth->getCompany()->id)->first();
|
||||||
|
|
||||||
return $this->tokens()->first();
|
return $this->tokens()->first();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user