mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-24 20:02:35 +01:00
Merge pull request #1063 from justein230/master
Add select account parameter for google authorization
This commit is contained in:
commit
4be0c567cc
@ -48,6 +48,7 @@ GITHUB_APP_ID=false
|
||||
GITHUB_APP_SECRET=false
|
||||
GOOGLE_APP_ID=false
|
||||
GOOGLE_APP_SECRET=false
|
||||
GOOGLE_SELECT_ACCOUNT=false
|
||||
OKTA_BASE_URL=false
|
||||
OKTA_APP_ID=false
|
||||
OKTA_APP_SECRET=false
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ return [
|
||||
'name' => 'Google',
|
||||
'auto_register' => env('GOOGLE_AUTO_REGISTER', false),
|
||||
'auto_confirm' => env('GOOGLE_AUTO_CONFIRM_EMAIL', false),
|
||||
'select_account' => env('GOOGLE_SELECT_ACCOUNT', false),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
|
Loading…
Reference in New Issue
Block a user