Remove car monitor auth DB fallback
This commit is contained in:
1 parent
16d336a169
commit
a1a9f29fcc
1 file changed
+6
-37
+6
-37
@@ -891,30 +891,6 @@ function car_monitor_launcher_session(): array
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
|
|
||||||
if (is_readable($commonAuth)) {
|
|
||||||
require_once $commonAuth;
|
|
||||||
|
|
||||||
if (function_exists('custom_has_auth_cookie') && custom_has_auth_cookie()) {
|
|
||||||
$isAdmin = function_exists('custom_auth_cookie_is_admin') && custom_auth_cookie_is_admin();
|
|
||||||
$session = ['authenticated' => true, 'admin' => $isAdmin];
|
|
||||||
return $session;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function_exists('custom_is_site_admin') && custom_is_site_admin()) {
|
|
||||||
if (function_exists('custom_issue_auth_cookie')) {
|
|
||||||
custom_issue_auth_cookie(true);
|
|
||||||
}
|
|
||||||
$session = ['authenticated' => true, 'admin' => true];
|
|
||||||
return $session;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cookieHeader === '') {
|
|
||||||
$session = ['authenticated' => false, 'admin' => false];
|
|
||||||
return $session;
|
|
||||||
}
|
|
||||||
|
|
||||||
$session = ['authenticated' => false, 'admin' => false];
|
$session = ['authenticated' => false, 'admin' => false];
|
||||||
return $session;
|
return $session;
|
||||||
}
|
}
|
||||||
@@ -1040,12 +1016,13 @@ function car_monitor_issue_pwa_cookie_if_requested(): void
|
|||||||
|
|
||||||
require_once $commonAuth;
|
require_once $commonAuth;
|
||||||
if (function_exists('custom_issue_auth_cookie')) {
|
if (function_exists('custom_issue_auth_cookie')) {
|
||||||
if (function_exists('custom_has_auth_cookie') && custom_has_auth_cookie()) {
|
$cookieHeader = trim((string)($_SERVER['HTTP_COOKIE'] ?? ''));
|
||||||
header('Location: /car/monitor.php', true, 302);
|
$remoteSession = $cookieHeader !== ''
|
||||||
exit;
|
? car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?session=1', null, $cookieHeader)
|
||||||
|
: null;
|
||||||
|
if (is_array($remoteSession) && !empty($remoteSession['authenticated'])) {
|
||||||
|
custom_issue_auth_cookie(!empty($remoteSession['admin']));
|
||||||
}
|
}
|
||||||
$isAdmin = function_exists('custom_is_site_admin') && custom_is_site_admin();
|
|
||||||
custom_issue_auth_cookie($isAdmin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: /car/monitor.php', true, 302);
|
header('Location: /car/monitor.php', true, 302);
|
||||||
@@ -1083,14 +1060,6 @@ function car_monitor_auth_api(): void
|
|||||||
json_response(['result' => 'ok']);
|
json_response(['result' => 'ok']);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
if (function_exists('custom_verify_password') && custom_verify_password($password)) {
|
|
||||||
custom_issue_auth_cookie(false);
|
|
||||||
json_response(['result' => 'ok']);
|
|
||||||
}
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
json_response(['result' => 'fail'], 401);
|
json_response(['result' => 'fail'], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user