Redirect HAL root to operator console

This commit is contained in:
oz
2026-10-27 04:42:45 +00:00
parent 83e3604b24
commit ac072e6f12
3 changed files with 9 additions and 0 deletions
+6
View File
@@ -22,6 +22,12 @@ function makeHal(over = {}) {
/** 운영자 계정 + 로그인 세션 */
async function loginOp(h) { ops.createAccount(h.d, { login: 'ozops', password: 'password-example-1', displayName: '오즈' }); const r = await invoke(h.app, 'POST', '/ops/api/login', { body: { login: 'ozops', password: 'password-example-1' } }); ok(r.json.ok, JSON.stringify(r.json)); return { cookie: r.cookies.aw_ops, csrf: r.json.csrf, as: (method, path, body, extra = {}) => invoke(h.app, method, path, { body, cookies: { aw_ops: r.cookies.aw_ops, ...(extra.cookies || {}) }, headers: { 'x-csrf': r.json.csrf, ...(extra.headers || {}) }, ip: extra.ip }) }; }
await test('HAL 루트 주소는 운영자 콘솔 기본 경로로 안내한다', async () => {
const h = makeHal();
const r = await invoke(h.app, 'GET', '/');
eq(r.status, 302, '루트 주소는 404가 아니라 운영자 콘솔로 이동');
eq(r.headers.Location, '/ops/', '운영자 콘솔의 표준 경로로 이동');
});
await test('화면 접근: 허용 네트워크 밖 403, 세션 없음/고객 쿠키 → 로그인 화면, 운영자 세션 → 콘솔(메뉴 14개 + 계정)', async () => {
const h = makeHal();
let r = await invoke(h.app, 'GET', '/ops/', { ip: '203.0.113.9' }); eq(r.status, 403); eq(r.json.error, 'access_denied');