mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #6105 from turbo124/v5-develop
Fixes for login where the user is not attached to an account
This commit is contained in:
commit
8825ce4585
@ -1 +1 @@
|
|||||||
5.2.5
|
5.2.6
|
@ -341,6 +341,7 @@ class CheckData extends Command
|
|||||||
$this->isValid = false;
|
$this->isValid = false;
|
||||||
|
|
||||||
if($this->option('paid_to_date')){
|
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->paid_to_date = $total_invoice_payments;
|
||||||
$client->save();
|
$client->save();
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,6 @@ class LoginController extends BaseController
|
|||||||
$cu = CompanyUser::query()
|
$cu = CompanyUser::query()
|
||||||
->where('user_id', $company_token->user_id);
|
->where('user_id', $company_token->user_id);
|
||||||
|
|
||||||
|
|
||||||
$cu->first()->account->companies->each(function ($company) use($cu, $request){
|
$cu->first()->account->companies->each(function ($company) use($cu, $request){
|
||||||
|
|
||||||
if($company->tokens()->where('is_system', true)->count() == 0)
|
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')
|
if($request->has('current_company') && $request->input('current_company') == 'true')
|
||||||
$cu->where("company_id", $company_token->company_id);
|
$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 = 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);
|
Auth::login($existing_user, true);
|
||||||
$existing_user->setCompany($existing_user->account->default_company);
|
$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 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 = 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);
|
Auth::login($existing_login_user, true);
|
||||||
$existing_login_user->setCompany($existing_login_user->account->default_company);
|
$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 = 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);
|
Auth::login($existing_login_user, true);
|
||||||
$existing_login_user->setCompany($existing_login_user->account->default_company);
|
$existing_login_user->setCompany($existing_login_user->account->default_company);
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.2.5',
|
'app_version' => '5.2.6',
|
||||||
'app_tag' => '5.2.5-release',
|
'app_tag' => '5.2.6-release',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
@ -3970,7 +3970,7 @@ $LANG = array(
|
|||||||
'details_of_recurring_invoice' => 'Here are some details about recurring invoice',
|
'details_of_recurring_invoice' => 'Here are some details about recurring invoice',
|
||||||
'cancellation' => 'Cancellation',
|
'cancellation' => 'Cancellation',
|
||||||
'about_cancellation' => 'In case you want to stop the recurring invoice, please click the request the 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!',
|
'cancellation_pending' => 'Cancellation pending, we\'ll be in touch!',
|
||||||
'list_of_payments' => 'List of payments',
|
'list_of_payments' => 'List of payments',
|
||||||
'payment_details' => 'Details of the payment',
|
'payment_details' => 'Details of the payment',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user