직접 접근 PIN 인증 화면 연결

This commit is contained in:
seo
2026-07-02 13:13:53 +09:00
parent de419b483a
commit 0afee4a018
2 changed files with 53 additions and 11 deletions
+51 -11
View File
@@ -956,26 +956,66 @@ function car_monitor_require_access(bool $json = false): void
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>차량 모니터 인증</title>
<style>
body{margin:0;min-height:100vh;display:grid;place-items:center;background:#f1f5f9;color:#334155;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.box{width:min(360px,calc(100vw - 40px));padding:28px;border:1px solid #dbe4f0;border-radius:18px;background:#fff;box-shadow:0 18px 50px rgba(15,23,42,.12);text-align:center}
h1{margin:0 0 10px;font-size:22px}
p{margin:0 0 20px;line-height:1.6;color:#64748b}
button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 24px;border:0;border-radius:999px;background:#2563eb;color:#fff;text-decoration:none;font-weight:700;cursor:pointer}
button:focus-visible{outline:3px solid rgba(37,99,235,.28);outline-offset:3px}
</style>
<link rel="stylesheet" href="https://chaegeon.com/custom/common/css/launcher.css">
</head>
<body>
<main class="box">
<h1>인증이 필요합니다</h1>
<button type="button" onclick="location.replace('https://chaegeon.com/blog')">확인</button>
<main class="car-auth-page">
<div id="findMyShortcut"></div>
</main>
<script src="https://chaegeon.com/custom/common/js/auth-pin.js"></script>
<script>
window.addEventListener('DOMContentLoaded', function () {
window.CustomAuthPin && window.CustomAuthPin.render({
mount: '#findMyShortcut',
apiUrl: '?mode=auth-login',
title: '비밀번호',
placeholder: '비밀번호',
backLabel: '채건닷컴',
backHref: 'https://chaegeon.com/',
onSuccess: function () { location.reload(); }
});
});
</script>
</body>
</html>
<?php
exit;
}
function car_monitor_auth_api(): void
{
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
if (!is_readable($commonAuth)) {
json_response(['result' => 'fail', 'message' => 'auth_module_missing'], 500);
}
require_once $commonAuth;
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['failMessages'])) {
json_response(['failMessages' => ['비밀번호가 틀립니다.']]);
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
json_response(['error' => 'method_not_allowed'], 405);
}
$data = request_payload();
$password = (string)($data['password'] ?? '');
if (preg_match('/^\d{4}$/', $password) !== 1) {
json_response(['result' => 'fail', 'message' => 'password_digits_only'], 401);
}
if (function_exists('custom_verify_password') && custom_verify_password($password)) {
custom_issue_auth_cookie(false);
json_response(['result' => 'ok']);
}
json_response(['result' => 'fail'], 401);
}
if (isset($_GET['mode']) && $_GET['mode'] === 'auth-login') {
car_monitor_auth_api();
}
if (isset($_GET['mode']) && $_GET['mode'] === 'ajax') {
car_monitor_require_access(true);