TK-FB(공장관리+신고)와 M-Project(부적합관리)를 3개 독립 시스템으로 분리하기 위한 전체 코드 구조 작성. - SSO 인증 서비스 (bcrypt + pbkdf2 이중 해시 지원) - System 1: 공장관리 (TK-FB 기반, 신고 코드 제거) - System 2: 신고 (TK-FB에서 workIssue 코드 추출) - System 3: 부적합관리 (M-Project 기반) - Gateway 포털 (path-based 라우팅) - 통합 docker-compose.yml 및 배포 스크립트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
151 lines
4.9 KiB
HTML
151 lines
4.9 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;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.login-box {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 40px;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
|
}
|
|
.login-box h1 {
|
|
text-align: center;
|
|
color: #1a56db;
|
|
font-size: 22px;
|
|
margin-bottom: 6px;
|
|
}
|
|
.login-box .sub {
|
|
text-align: center;
|
|
color: #6b7280;
|
|
font-size: 13px;
|
|
margin-bottom: 28px;
|
|
}
|
|
.form-group { margin-bottom: 16px; }
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
color: #374151;
|
|
margin-bottom: 6px;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 10px 14px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
}
|
|
.form-group input:focus {
|
|
border-color: #1a56db;
|
|
box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
|
|
}
|
|
.btn-submit {
|
|
width: 100%;
|
|
padding: 12px;
|
|
background: #1a56db;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
margin-top: 8px;
|
|
}
|
|
.btn-submit:hover { background: #1e40af; }
|
|
.btn-submit:disabled { background: #93c5fd; cursor: not-allowed; }
|
|
.error-msg {
|
|
color: #dc2626;
|
|
font-size: 13px;
|
|
text-align: center;
|
|
margin-top: 12px;
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-box">
|
|
<h1>TK 공장관리 시스템</h1>
|
|
<p class="sub">통합 로그인</p>
|
|
|
|
<form id="loginForm" onsubmit="handleLogin(event)">
|
|
<div class="form-group">
|
|
<label for="username">사용자명</label>
|
|
<input type="text" id="username" name="username" required autofocus autocomplete="username">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">비밀번호</label>
|
|
<input type="password" id="password" name="password" required autocomplete="current-password">
|
|
</div>
|
|
<button type="submit" class="btn-submit" id="submitBtn">로그인</button>
|
|
<p class="error-msg" id="errorMsg"></p>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
async function handleLogin(e) {
|
|
e.preventDefault();
|
|
const btn = document.getElementById('submitBtn');
|
|
const errEl = document.getElementById('errorMsg');
|
|
errEl.style.display = 'none';
|
|
btn.disabled = true;
|
|
btn.textContent = '로그인 중...';
|
|
|
|
try {
|
|
const res = await fetch('/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
username: document.getElementById('username').value,
|
|
password: document.getElementById('password').value
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
|
|
if (!res.ok || !data.success) {
|
|
throw new Error(data.error || '로그인에 실패했습니다');
|
|
}
|
|
|
|
// 토큰과 유저 정보 저장
|
|
localStorage.setItem('sso_token', data.access_token);
|
|
localStorage.setItem('sso_user', JSON.stringify(data.user));
|
|
if (data.refresh_token) {
|
|
localStorage.setItem('sso_refresh_token', data.refresh_token);
|
|
}
|
|
|
|
// 포털로 이동
|
|
const redirect = new URLSearchParams(location.search).get('redirect');
|
|
window.location.href = redirect || '/';
|
|
} catch (err) {
|
|
errEl.textContent = err.message;
|
|
errEl.style.display = '';
|
|
} finally {
|
|
btn.disabled = false;
|
|
btn.textContent = '로그인';
|
|
}
|
|
}
|
|
|
|
// 이미 로그인 되어있으면 포털로
|
|
if (localStorage.getItem('sso_token')) {
|
|
window.location.href = '/';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|