1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Http/Middleware/SessionDomains.php

43 lines
925 B
PHP
Raw Normal View History

2022-01-15 05:58:33 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2022-01-15 05:58:33 +01:00
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Middleware;
use App\Utils\Ninja;
use Closure;
use Illuminate\Http\Request;
class SessionDomains
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Ninja::isSelfHost()) {
2022-01-15 05:58:33 +01:00
return $next($request);
}
$domain_name = $request->getHost();
2023-11-24 00:23:40 +01:00
if (strpos($domain_name, config('ninja.app_domain')) !== false) {
} else {
config(['session.domain' => $domain_name]);
}
return $next($request);
2022-01-15 05:58:33 +01:00
}
}