Merge pull request #5143 from turbo124/v5-develop

Fixes for connected account
This commit is contained in:
David Bomba 2021-03-16 22:29:38 +11:00 committed by GitHub
commit d4b05d7d7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -269,12 +269,14 @@ class LoginController extends BaseController
$user = $google->getTokenResponse(request()->input('id_token'));
if (is_array($user)) {
$query = [
'oauth_user_id' => $google->harvestSubField($user),
'oauth_provider_id'=> 'google',
];
if ($existing_user = MultiDB::hasUser($query)) {
Auth::login($existing_user, true);
$existing_user->setCompany($existing_user->account->default_company);
@ -282,6 +284,7 @@ class LoginController extends BaseController
->where('user_id', auth()->user()->id);
return $this->listResponse($cu);
}
}

View File

@ -87,7 +87,16 @@ class ConnectedAccountController extends BaseController
$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)) {

View File

@ -214,9 +214,14 @@ class Import implements ShouldQueue
// if($check_data['status'] == 'errors')
// throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data));
Mail::to($this->user->email, $this->user->name())
->send(new MigrationCompleted($this->company, implode("<br>",$check_data)));
try{
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*/
VersionCheck::dispatch();
CompanySizeCheck::dispatch();