diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 14785b462ac2..797d74f69066 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -341,6 +341,7 @@ class CheckData extends Command $this->isValid = false; if($this->option('paid_to_date')){ + $this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." Fixing {$client->paid_to_date} to {$total_invoice_payments}"); $client->paid_to_date = $total_invoice_payments; $client->save(); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index ec7899ab6f0e..b806f69675cd 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -300,7 +300,6 @@ class LoginController extends BaseController $cu = CompanyUser::query() ->where('user_id', $company_token->user_id); - $cu->first()->account->companies->each(function ($company) use($cu, $request){ if($company->tokens()->where('is_system', true)->count() == 0) @@ -309,7 +308,6 @@ class LoginController extends BaseController } }); - if($request->has('current_company') && $request->input('current_company') == 'true') $cu->where("company_id", $company_token->company_id); @@ -361,6 +359,9 @@ class LoginController extends BaseController if ($existing_user = MultiDB::hasUser($query)) { + if(!$existing_user->account) + return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); + Auth::login($existing_user, true); $existing_user->setCompany($existing_user->account->default_company); @@ -387,6 +388,9 @@ class LoginController extends BaseController //If this is a result user/email combo - lets add their OAuth details details if($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user)])) { + if(!$existing_login_user->account) + return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); + Auth::login($existing_login_user, true); $existing_login_user->setCompany($existing_login_user->account->default_company); @@ -422,6 +426,9 @@ class LoginController extends BaseController if($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user)])) { + if(!$existing_login_user->account) + return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); + Auth::login($existing_login_user, true); $existing_login_user->setCompany($existing_login_user->account->default_company); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 070975170120..ac3d8f0e1a31 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -3970,7 +3970,7 @@ $LANG = array( 'details_of_recurring_invoice' => 'Here are some details about recurring invoice', 'cancellation' => 'Cancellation', 'about_cancellation' => 'In case you want to stop the recurring invoice, please click the request the cancellation.', - 'cancellation_warning' => 'Warning! You are requesting a cancellation of this service.\n Your service may be cancelled with no further notification to you.', + 'cancellation_warning' => 'Warning! You are requesting a cancellation of this service. Your service may be cancelled with no further notification to you.', 'cancellation_pending' => 'Cancellation pending, we\'ll be in touch!', 'list_of_payments' => 'List of payments', 'payment_details' => 'Details of the payment',