public function startLogIn($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
- if ($socialDriver == 'google' && env('GOOGLE_SELECT_ACCOUNT')) {
- return $this->socialite->driver($driver)->with(['prompt' => 'select_account'])->redirect();
- }
- return $this->socialite->driver($driver)->redirect();
+ return $this->redirectToSocialProvider($driver);
}
/**
public function startRegister($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
- if ($socialDriver == 'google' && env('GOOGLE_SELECT_ACCOUNT')) {
- return $this->socialite->driver($driver)->with(['prompt' => 'select_account'])->redirect();
- }
- return $this->socialite->driver($driver)->redirect();
+ return $this->redirectToSocialProvider($driver);
}
/**
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)]));
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();
+ }
}