1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Merge pull request #1063 from justein230/master

Add select account parameter for google authorization
This commit is contained in:
Dan Brown
2018-11-10 14:32:28 +00:00
committed by GitHub
3 changed files with 18 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ class SocialAuthService
public function startLogIn($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
return $this->socialite->driver($driver)->redirect();
return $this->redirectToSocialProvider($driver)->redirect();
}
/**
@@ -52,7 +52,7 @@ class SocialAuthService
public function startRegister($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
return $this->socialite->driver($driver)->redirect();
return $this->redirectToSocialProvider($driver)->redirect();
}
/**
@@ -247,4 +247,18 @@ class SocialAuthService
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
*/
public function redirectToSocialProvider($driver)
{
if ($driver == 'google' && config('services.google.select_account'))
{
return $this->socialite->driver($driver)->with(['prompt' => 'select_account']);
}
return $this->socialite->driver($driver);
}
}