X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/89de328439729a70b7faafc72c38c08489a436a3..refs/pull/1462/head:/app/Auth/Access/SocialAuthService.php diff --git a/app/Auth/Access/SocialAuthService.php b/app/Auth/Access/SocialAuthService.php index 62025bf7c..0d46b9f88 100644 --- a/app/Auth/Access/SocialAuthService.php +++ b/app/Auth/Access/SocialAuthService.php @@ -40,7 +40,7 @@ class SocialAuthService public function startLogIn($socialDriver) { $driver = $this->validateDriver($socialDriver); - return $this->redirectToSocialProvider($driver)->redirect(); + return $this->getSocialDriver($driver)->redirect(); } /** @@ -52,7 +52,7 @@ class SocialAuthService public function startRegister($socialDriver) { $driver = $this->validateDriver($socialDriver); - return $this->redirectToSocialProvider($driver)->redirect(); + return $this->getSocialDriver($driver)->redirect(); } /** @@ -250,16 +250,17 @@ class SocialAuthService /** * Provide redirect options per service for the Laravel Socialite driver - * @param $driver - * @return \Symfony\Component\HttpFoundation\RedirectResponse + * @param $driverName + * @return \Laravel\Socialite\Contracts\Provider */ - public function redirectToSocialProvider($driver) + public function getSocialDriver(string $driverName) { - if ($driver == 'google' && config('services.google.select_account')) - { - return $this->socialite->driver($driver)->with(['prompt' => 'select_account']); + $driver = $this->socialite->driver($driverName); + + if ($driverName === 'google' && config('services.google.select_account')) { + $driver->with(['prompt' => 'select_account']); } - return $this->socialite->driver($driver); + return $driver; } }