1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #5875 from turbo124/v5-develop

Minor fixes
This commit is contained in:
David Bomba 2021-06-01 17:25:26 +10:00 committed by GitHub
commit a3779d0b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,7 +490,7 @@ class LoginController extends BaseController
if (request()->has('code')) {
return $this->handleProviderCallback($provider);
} else {
return Socialite::driver($provider)->with(['redirect_uri' => "/auth/google"])->scopes($scopes)->redirect();
return Socialite::driver($provider)->with(['redirect_uri' => config('ninja.app_url')."/auth/google"])->scopes($scopes)->redirect();
}
}
@ -502,19 +502,8 @@ class LoginController extends BaseController
if($user = OAuth::handleAuth($socialite_user, $provider))
{
Auth::login($user, true);
return redirect($this->redirectTo);
}
else if(MultiDB::checkUserEmailExists($socialite_user->getEmail()))
{
Session::flash('error', 'User exists in system, but not with this authentication method'); //todo add translations
return view('auth.login');
}
else {
//todo
$name = OAuth::splitName($socialite_user->getName());
nlog('found user and updating their user record');
$update_user = [
'first_name' => $name[0],
@ -526,15 +515,13 @@ class LoginController extends BaseController
'oauth_user_token' => $socialite_user->refreshToken,
];
$user->update($update_user);
// $account = CreateAccount::dispatchNow($new_account);
// Auth::login($account->default_company->owner(), true);
// $cookie = cookie('db', $account->default_company->db);
return redirect('/#/');
}
else {
nlog("user not found for oauth");
}
return redirect('/#/');
}
}