diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index 3f9d0503f0..3cba611bef 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -36,12 +36,9 @@ class ContactLoginController extends Controller public function showLoginForm(Request $request) { - //if we are on the root domain invoicing.co do not show any company logos - // if(Ninja::isHosted() && count(explode('.', request()->getHost())) == 2){ - // $company = null; - // }else $company = false; + $account = false; if($request->has('company_key')){ MultiDB::findAndSetDbByCompanyKey($request->input('company_key')); @@ -65,13 +62,16 @@ class ContactLoginController extends Controller } elseif (Ninja::isSelfHost()) { - $company = Account::first()->default_company; + $account = Account::first(); + $company = $account->default_company; } else { $company = null; } - $account_id = $request->get('account_id'); - $account = Account::find($account_id); + if(!$account){ + $account_id = $request->get('account_id'); + $account = Account::find($account_id); + } return $this->render('auth.login', ['account' => $account, 'company' => $company]);