1
0
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:
Dan Brown 2018-11-10 14:32:28 +00:00 committed by GitHub
commit 4be0c567cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -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

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);
}
}

View File

@ -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' => [