1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +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
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. 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
}
}