diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index e91afe8b6a..f6b310fad2 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -213,44 +213,11 @@ class LoginController extends BaseController $user = $user->fresh(); } - // $user->setCompany($user->account->default_company); - // $this->setLoginCache($user); - - // $cu = CompanyUser::query() - // ->where('user_id', auth()->user()->id); - $cu = $this->hydrateCompanyUser(); if($cu->count() == 0) return response()->json(['message' => 'User found, but not attached to any companies, please see your administrator'], 400); - // $truth = app()->make(TruthSource::class); - - // $truth->setCompanyUser($cu->first()); - // $truth->setUser(auth()->user()); - // $truth->setCompany($user->account->default_company); - - // if(!$cu->exists()) - // return response()->json(['message' => 'User not linked to any companies'], 403); - - // /* Ensure the user has a valid token */ - // if($user->company_users()->count() != $user->tokens()->count()) - // { - - // $user->companies->each(function($company) use($user, $request){ - - // if(!CompanyToken::where('user_id', $user->id)->where('company_id', $company->id)->exists()){ - - // CreateCompanyToken::dispatchNow($company, $user, $request->server('HTTP_USER_AGENT')); - - // } - - // }); - - // } - - // $truth->setCompanyToken(CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $user->account->default_company->id)->first()); - /*On the hosted platform, only owners can login for free/pro accounts*/ if (Ninja::isHosted() && !$cu->first()->is_owner && !$user->account->isEnterpriseClient()) return response()->json(['message' => 'Pro / Free accounts only the owner can log in. Please upgrade'], 403);