1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Fix for Laravel\Socialite\Two\InvalidStateException

This commit is contained in:
Hillel Coren 2017-04-18 15:44:08 +03:00
parent ff87f001c3
commit 3c5565022d
2 changed files with 19 additions and 3 deletions

View File

@ -118,7 +118,17 @@ class AuthController extends Controller
public function getLoginWrapper()
{
if (! Utils::isNinja() && ! User::count()) {
return redirect()->to('invoice_now');
return redirect()->to('/setup');
}
if (Utils::isNinja()) {
// make sure the user is on SITE_URL/login to ensure OAuth works
$requestURL = request()->url();
$loginURL = SITE_URL . '/login';
$subdomain = Utils::getSubdomain(request()->url());
if ($requestURL != $loginURL && ! strstr($subdomain, 'webapp-')) {
return redirect()->to($loginURL);
}
}
return self::getLogin();

View File

@ -969,10 +969,11 @@ class Utils
return $str;
}
public static function getSubdomainPlaceholder()
public static function getSubdomain($url)
{
$parts = parse_url(SITE_URL);
$parts = parse_url($url);
$subdomain = '';
if (isset($parts['host'])) {
$host = explode('.', $parts['host']);
if (count($host) > 2) {
@ -983,6 +984,11 @@ class Utils
return $subdomain;
}
public static function getSubdomainPlaceholder()
{
return static::getSubdomain(SITE_URL);
}
public static function getDomainPlaceholder()
{
$parts = parse_url(SITE_URL);