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

Merge branch 'master' into 2019-design

This commit is contained in:
Dan Brown
2018-11-11 11:44:35 +00:00
80 changed files with 5379 additions and 5278 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->getSocialDriver($driver)->redirect();
}
/**
@@ -52,7 +52,7 @@ class SocialAuthService
public function startRegister($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
return $this->socialite->driver($driver)->redirect();
return $this->getSocialDriver($driver)->redirect();
}
/**
@@ -247,4 +247,20 @@ 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 $driverName
* @return \Laravel\Socialite\Contracts\Provider
*/
public function getSocialDriver(string $driverName)
{
$driver = $this->socialite->driver($driverName);
if ($driverName === 'google' && config('services.google.select_account')) {
$driver->with(['prompt' => 'select_account']);
}
return $driver;
}
}

View File

@@ -92,10 +92,15 @@ function baseUrl($path, $forceAppDomain = false)
if ($isFullUrl && !$forceAppDomain) {
return $path;
}
$path = trim($path, '/');
$base = rtrim(config('app.url'), '/');
// Remove non-specified domain if forced and we have a domain
if ($isFullUrl && $forceAppDomain) {
if (!empty($base) && strpos($path, $base) === 0) {
$path = trim(substr($path, strlen($base) - 1));
}
$explodedPath = explode('/', $path);
$path = implode('/', array_splice($explodedPath, 3));
}
@@ -105,7 +110,7 @@ function baseUrl($path, $forceAppDomain = false)
return url($path);
}
return rtrim(config('app.url'), '/') . '/' . $path;
return $base . '/' . $path;
}
/**