mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for login where the user is not attached to an account
This commit is contained in:
parent
f245457a6c
commit
293b12e348
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user