mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:44:28 -04:00
Merge pull request #5143 from turbo124/v5-develop
Fixes for connected account
This commit is contained in:
commit
d4b05d7d7b
@ -269,12 +269,14 @@ class LoginController extends BaseController
|
|||||||
$user = $google->getTokenResponse(request()->input('id_token'));
|
$user = $google->getTokenResponse(request()->input('id_token'));
|
||||||
|
|
||||||
if (is_array($user)) {
|
if (is_array($user)) {
|
||||||
|
|
||||||
$query = [
|
$query = [
|
||||||
'oauth_user_id' => $google->harvestSubField($user),
|
'oauth_user_id' => $google->harvestSubField($user),
|
||||||
'oauth_provider_id'=> 'google',
|
'oauth_provider_id'=> 'google',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($existing_user = MultiDB::hasUser($query)) {
|
if ($existing_user = MultiDB::hasUser($query)) {
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -282,6 +284,7 @@ class LoginController extends BaseController
|
|||||||
->where('user_id', auth()->user()->id);
|
->where('user_id', auth()->user()->id);
|
||||||
|
|
||||||
return $this->listResponse($cu);
|
return $this->listResponse($cu);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,16 @@ class ConnectedAccountController extends BaseController
|
|||||||
|
|
||||||
$google = new Google();
|
$google = new Google();
|
||||||
|
|
||||||
$user = $google->getTokenResponse(request()->input('id_token'));
|
if($request->header('X-API-OAUTH-PASSWORD') && strlen($request->header('X-API-OAUTH-PASSWORD')) >=1){
|
||||||
|
$user = $google->getTokenResponse($request->header('X-API-OAUTH-PASSWORD'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return response()
|
||||||
|
->json(['message' => 'No valid oauth parameter sent.'], 401)
|
||||||
|
->header('X-App-Version', config('ninja.app_version'))
|
||||||
|
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (is_array($user)) {
|
if (is_array($user)) {
|
||||||
|
|
||||||
|
@ -214,9 +214,14 @@ class Import implements ShouldQueue
|
|||||||
// if($check_data['status'] == 'errors')
|
// if($check_data['status'] == 'errors')
|
||||||
// throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data));
|
// throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data));
|
||||||
|
|
||||||
Mail::to($this->user->email, $this->user->name())
|
try{
|
||||||
->send(new MigrationCompleted($this->company, implode("<br>",$check_data)));
|
Mail::to($this->user->email, $this->user->name())
|
||||||
|
->send(new MigrationCompleted($this->company, implode("<br>",$check_data)));
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
nlog($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/*After a migration first some basic jobs to ensure the system is up to date*/
|
/*After a migration first some basic jobs to ensure the system is up to date*/
|
||||||
VersionCheck::dispatch();
|
VersionCheck::dispatch();
|
||||||
CompanySizeCheck::dispatch();
|
CompanySizeCheck::dispatch();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user