Added function for redirect with parameters for Socialite
This commit is contained in:
parent
216358c6e4
commit
0283ab11b5
|
@ -40,10 +40,7 @@ class SocialAuthService
|
||||||
public function startLogIn($socialDriver)
|
public function startLogIn($socialDriver)
|
||||||
{
|
{
|
||||||
$driver = $this->validateDriver($socialDriver);
|
$driver = $this->validateDriver($socialDriver);
|
||||||
if ($socialDriver == 'google' && env('GOOGLE_SELECT_ACCOUNT')) {
|
return $this->redirectToSocialProvider($driver);
|
||||||
return $this->socialite->driver($driver)->with(['prompt' => 'select_account'])->redirect();
|
|
||||||
}
|
|
||||||
return $this->socialite->driver($driver)->redirect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,10 +52,7 @@ class SocialAuthService
|
||||||
public function startRegister($socialDriver)
|
public function startRegister($socialDriver)
|
||||||
{
|
{
|
||||||
$driver = $this->validateDriver($socialDriver);
|
$driver = $this->validateDriver($socialDriver);
|
||||||
if ($socialDriver == 'google' && env('GOOGLE_SELECT_ACCOUNT')) {
|
return $this->redirectToSocialProvider($driver);
|
||||||
return $this->socialite->driver($driver)->with(['prompt' => 'select_account'])->redirect();
|
|
||||||
}
|
|
||||||
return $this->socialite->driver($driver)->redirect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,4 +247,19 @@ class SocialAuthService
|
||||||
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)]));
|
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)]));
|
||||||
return redirect(user()->getEditUrl());
|
return redirect(user()->getEditUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide redirect options per service for the Laravel Socialite driver
|
||||||
|
* @param $driver
|
||||||
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function redirectToSocialProvider($driver)
|
||||||
|
{
|
||||||
|
if ($driver == 'google' && config('services.google.select_account'))
|
||||||
|
{
|
||||||
|
return $this->socialite->driver($driver)->with(['prompt' => 'select_account'])->redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->socialite->driver($driver)->redirect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue