TEMP DEV: open /v4/radar without auth; keep login redirects on current host.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 18:59:33 -04:00
parent 0b517c4647
commit 84e9143f59
4 changed files with 20 additions and 6 deletions

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'https://ms1crm.interne.ca/';
$config['base_url'] = 'https://ms1crmdev.progiweb.net/';
$config['titre']='Ms1-CRM-dev';
$config['emailreservation']='mayrand.p@ms1timing.com';
/*

View File

@ -17,7 +17,7 @@ class App extends BaseConfig
* E.g., http://example.com/
* public string $baseURL = 'https://ms1crmdev.progiweb.net/';
*/
public string $baseURL = 'https://ms1crm.interne.ca/';
public string $baseURL = 'https://ms1crmdev.progiweb.net/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.

View File

@ -72,7 +72,9 @@ class Filters extends BaseFilters
* }
*/
public array $globals = [
'before' => ['auth'
'before' => [
// TEMP DEV (soirée test) — Radar sans auth. Remettre auth strict après.
'auth' => ['except' => ['radar', 'radar/*']],
// 'honeypot',
// 'csrf',
// 'invalidchars',

View File

@ -25,7 +25,7 @@ class Auth implements FilterInterface
'/'
);
return redirect()->to('/login');
return redirect()->to($this->loginUrl());
}
$db = Database::connect();
@ -48,7 +48,7 @@ class Auth implements FilterInterface
'/'
);
return redirect()->to('/login');
return redirect()->to($this->loginUrl());
}
// Charger utilisateur
@ -61,7 +61,7 @@ class Auth implements FilterInterface
session()->destroy();
return redirect()->to('/login');
return redirect()->to($this->loginUrl());
}
// Si session CI4 inexistante → la créer
@ -78,4 +78,16 @@ class Auth implements FilterInterface
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
}
/**
* Toujours le host courant (évite baseURL figé → prod / autre site).
*/
private function loginUrl(): string
{
$https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https');
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
return ($https ? 'https' : 'http') . '://' . $host . '/login';
}
}