]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/Access/SocialAuthService.php
Update maintenance.php
[bookstack] / app / Auth / Access / SocialAuthService.php
index 62025bf7cf2434d8d3feb832149b81d2817b77a4..0d46b9f882d5ebe6afe1d08fb0d7b4714c9eeb74 100644 (file)
@@ -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;
     }
 }