feat(ui): /orderlist 미인증 시 dbx-main 로그인으로 위임, 프로필 헤더 개선

- read_root() 가 세션 미인증 시 dbx-main /login?next=/orderlist/ 로 302.
  OMS 는 더 이상 자체 로그인 UI 를 가지지 않는다.
- index.html: #login-screen 블록 제거, dashboard 만 렌더.
- 우측 상단 프로필 영역을 메인 페이지 스타일로 개편:
  이름 + 이메일 + 아바타(Google picture URL, 폴백 아이콘) + 로그아웃 텍스트 버튼.
- main.py 가 세션의 user_name/user_email/user_picture 를 HTML placeholder 로 치환.
- app.js checkAuth() 단순화: 화면 토글 제거, 401 시 dbx-main 로그인으로 자동 이동.
- style.css 에 새 프로필 영역 CSS 추가.

Google 아바타가 보이려면 dbx-main 도 같이 user_picture 를 세션 top-level 에
저장하도록 수정됨 (dbx-main 별도 커밋).
This commit is contained in:
2026-05-24 14:20:42 +09:00
parent 1eabd7183c
commit 931ad173ab
4 changed files with 163 additions and 51 deletions
+10 -14
View File
@@ -3,8 +3,7 @@ document.addEventListener('DOMContentLoaded', () => {
const appUrl = (path) => `${APP_BASE_PATH}${path.startsWith('/') ? path : `/${path}`}`;
// --- Elements ---
const loginScreen = document.getElementById('login-screen');
const dashboardScreen = document.getElementById('dashboard-screen');
// loginScreen 은 더 이상 존재하지 않음 (서버에서 미인증 사용자를 dbx-main 으로 리다이렉트)
const userNameEl = document.getElementById('user-name');
const searchInputs = {
@@ -185,26 +184,23 @@ document.addEventListener('DOMContentLoaded', () => {
}
// --- Authentication ---
// 미인증 사용자는 서버(read_root) 가 이미 dbx-main 로그인으로 리다이렉트하므로
// 여기서는 is_admin 확인 + 세션 만료 시 다시 dbx-main 으로 보내는 역할만 한다.
async function checkAuth() {
try {
const res = await fetch(appUrl('/api/users/me'));
if (res.ok) {
currentUser = await res.json();
userNameEl.textContent = currentUser.name;
loginScreen.classList.remove('active');
loginScreen.classList.add('hidden');
dashboardScreen.classList.remove('hidden');
dashboardScreen.classList.add('active');
if (userNameEl && currentUser.name) {
userNameEl.textContent = currentUser.name;
}
if (btnDataManagement) {
btnDataManagement.style.display = currentUser.is_admin ? 'inline-flex' : 'none';
}
} else {
loginScreen.classList.remove('hidden');
loginScreen.classList.add('active');
dashboardScreen.classList.add('hidden');
dashboardScreen.classList.remove('active');
} else if (res.status === 401) {
// 세션 만료 — dbx-main 로그인으로 위임 (next 로 현재 위치 보존)
const next = encodeURIComponent((APP_BASE_PATH || '') + '/');
window.location.href = appUrl('/login') + '?next=' + next;
}
} catch (error) {
console.error('Auth check error', error);