Chrome은 secure 쿠키 삭제 시 삭제 문자열에도 secure 플래그가 필요함. 6개 파일의 cookieRemove 함수에 '; secure; samesite=lax' 추가. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
255 lines
9.5 KiB
HTML
255 lines
9.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>TK 공장관리 시스템</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
background: #f0f2f5;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.header {
|
|
background: #1a56db;
|
|
color: white;
|
|
padding: 16px 24px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
.header h1 { font-size: 20px; font-weight: 600; }
|
|
.user-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
font-size: 14px;
|
|
}
|
|
.user-info span { opacity: 0.9; }
|
|
.btn-logout {
|
|
background: rgba(255,255,255,0.2);
|
|
color: white;
|
|
border: none;
|
|
padding: 6px 14px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
}
|
|
.btn-logout:hover { background: rgba(255,255,255,0.3); }
|
|
.container {
|
|
max-width: 900px;
|
|
margin: 40px auto;
|
|
padding: 0 20px;
|
|
flex: 1;
|
|
}
|
|
.welcome {
|
|
text-align: center;
|
|
margin-bottom: 36px;
|
|
}
|
|
.welcome h2 { font-size: 26px; color: #1f2937; margin-bottom: 8px; }
|
|
.welcome p { color: #6b7280; font-size: 15px; }
|
|
.systems {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
|
gap: 20px;
|
|
}
|
|
.system-card {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 28px;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
border: 2px solid transparent;
|
|
}
|
|
.system-card:hover {
|
|
transform: translateY(-4px);
|
|
box-shadow: 0 8px 25px rgba(0,0,0,0.12);
|
|
}
|
|
.system-card.s1 { border-top: 4px solid #1a56db; }
|
|
.system-card.s2 { border-top: 4px solid #dc2626; }
|
|
.system-card.s3 { border-top: 4px solid #059669; }
|
|
.system-icon { font-size: 36px; margin-bottom: 14px; }
|
|
.system-card h3 { font-size: 18px; color: #1f2937; margin-bottom: 6px; }
|
|
.system-card p { color: #6b7280; font-size: 13px; line-height: 1.5; }
|
|
.system-card .badge {
|
|
display: inline-block;
|
|
margin-top: 12px;
|
|
padding: 3px 10px;
|
|
border-radius: 12px;
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
}
|
|
.s1 .badge { background: #dbeafe; color: #1d4ed8; }
|
|
.s2 .badge { background: #fee2e2; color: #dc2626; }
|
|
.s3 .badge { background: #d1fae5; color: #059669; }
|
|
.footer {
|
|
text-align: center;
|
|
padding: 20px;
|
|
color: #9ca3af;
|
|
font-size: 12px;
|
|
}
|
|
.login-prompt {
|
|
text-align: center;
|
|
padding: 60px 20px;
|
|
}
|
|
.login-prompt h2 { margin-bottom: 16px; color: #1f2937; }
|
|
.btn-login {
|
|
display: inline-block;
|
|
background: #1a56db;
|
|
color: white;
|
|
padding: 12px 32px;
|
|
border-radius: 8px;
|
|
text-decoration: none;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
}
|
|
.btn-login:hover { background: #1e40af; }
|
|
.no-access {
|
|
opacity: 0.5;
|
|
pointer-events: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>TK 공장관리 시스템</h1>
|
|
<div class="user-info" id="userInfo" style="display:none">
|
|
<span id="userName"></span>
|
|
<span id="userRole"></span>
|
|
<button class="btn-logout" onclick="logout()">로그아웃</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<!-- 로그인 전 -->
|
|
<div class="login-prompt" id="loginPrompt">
|
|
<h2>시스템에 접속하려면 로그인하세요</h2>
|
|
<a href="/login" class="btn-login">로그인</a>
|
|
</div>
|
|
|
|
<!-- 로그인 후 -->
|
|
<div id="dashboard" style="display:none">
|
|
<div class="welcome">
|
|
<h2 id="welcomeText">환영합니다</h2>
|
|
<p>사용할 시스템을 선택하세요</p>
|
|
</div>
|
|
<div class="systems">
|
|
<a href="/pages/dashboard.html" class="system-card s1" id="card-s1">
|
|
<div class="system-icon">🏭</div>
|
|
<h3>공장관리</h3>
|
|
<p>작업보고, 근태관리, TBM, 순회점검, 장비관리 등 현장 운영 전반</p>
|
|
<span class="badge">System 1</span>
|
|
</a>
|
|
<a id="card-s2-link" class="system-card s2" id="card-s2">
|
|
<div class="system-icon">🚨</div>
|
|
<h3>신고 시스템</h3>
|
|
<p>안전/부적합 이슈 신고, 처리현황 추적, 부적합 자동 연동</p>
|
|
<span class="badge">System 2</span>
|
|
</a>
|
|
<a id="card-s3-link" class="system-card s3" id="card-s3">
|
|
<div class="system-icon">📋</div>
|
|
<h3>부적합 관리</h3>
|
|
<p>부적합 이슈 접수, 처리, 리포트 생성, 프로젝트별 현황 관리</p>
|
|
<span class="badge">System 3</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer">TK Factory Services v1.0</div>
|
|
|
|
<script src="/shared/nav-header.js"></script>
|
|
<script>
|
|
var ssoCookie = {
|
|
get: function(name) {
|
|
var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
return match ? decodeURIComponent(match[1]) : null;
|
|
},
|
|
remove: function(name) {
|
|
var cookie = name + '=; path=/; max-age=0';
|
|
if (window.location.hostname.includes('technicalkorea.net')) {
|
|
cookie += '; domain=.technicalkorea.net; secure; samesite=lax';
|
|
}
|
|
document.cookie = cookie;
|
|
}
|
|
};
|
|
|
|
function getToken() {
|
|
return ssoCookie.get('sso_token') || localStorage.getItem('sso_token');
|
|
}
|
|
function getUser() {
|
|
var raw = ssoCookie.get('sso_user') || localStorage.getItem('sso_user');
|
|
try { return JSON.parse(raw); } catch(e) { return null; }
|
|
}
|
|
|
|
function init() {
|
|
var token = getToken();
|
|
var user = getUser();
|
|
|
|
if (token && user) {
|
|
showDashboard(user);
|
|
} else {
|
|
document.getElementById('loginPrompt').style.display = '';
|
|
document.getElementById('dashboard').style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function showDashboard(user) {
|
|
document.getElementById('loginPrompt').style.display = 'none';
|
|
document.getElementById('dashboard').style.display = '';
|
|
document.getElementById('userInfo').style.display = 'flex';
|
|
document.getElementById('userName').textContent = user.name || user.username;
|
|
document.getElementById('userRole').textContent = '(' + (user.role || '') + ')';
|
|
document.getElementById('welcomeText').textContent =
|
|
(user.name || user.username) + '님, 환영합니다';
|
|
|
|
// 접근 권한에 따라 카드 비활성화
|
|
const access = user.system_access || {};
|
|
if (access.system1 === false) document.getElementById('card-s1').classList.add('no-access');
|
|
if (access.system2 === false) document.getElementById('card-s2').classList.add('no-access');
|
|
if (access.system3 === false) document.getElementById('card-s3').classList.add('no-access');
|
|
}
|
|
|
|
function logout() {
|
|
ssoCookie.remove('sso_token');
|
|
ssoCookie.remove('sso_user');
|
|
ssoCookie.remove('sso_refresh_token');
|
|
['sso_token','sso_user','sso_refresh_token','token','user','access_token','currentUser','current_user','userInfo','userPageAccess'].forEach(function(k) {
|
|
localStorage.removeItem(k);
|
|
});
|
|
fetch('/auth/logout', { method: 'POST' }).catch(function(){});
|
|
location.reload();
|
|
}
|
|
|
|
// 서브도메인 링크 설정
|
|
function setupSystemLinks() {
|
|
var hostname = window.location.hostname;
|
|
var protocol = window.location.protocol;
|
|
var s2Link, s3Link;
|
|
|
|
if (hostname.includes('technicalkorea.net')) {
|
|
s2Link = protocol + '//tkreport.technicalkorea.net';
|
|
s3Link = protocol + '//tkqc.technicalkorea.net';
|
|
} else {
|
|
// 개발 환경: 포트 기반
|
|
s2Link = protocol + '//' + hostname + ':30180';
|
|
s3Link = protocol + '//' + hostname + ':30280';
|
|
}
|
|
|
|
document.getElementById('card-s2-link').href = s2Link;
|
|
document.getElementById('card-s3-link').href = s3Link;
|
|
}
|
|
setupSystemLinks();
|
|
|
|
init();
|
|
</script>
|
|
</body>
|
|
</html>
|