Fix: 페이지 간 이동 시 로그아웃 문제 해결 및 기능 개선

- 토큰 저장 키 통일 (access_token으로 일관성 확보)
- 일일공수 페이지 API 스크립트 로딩 순서 수정
- 프로젝트 관리 페이지 비활성 프로젝트 표시 문제 해결
- 업로드 카테고리에 '기타' 항목 추가 (백엔드 schemas.py 포함)
- 비밀번호 변경 기능 API 연동으로 수정
- 프로젝트 드롭다운 z-index 문제 해결
- CORS 설정 및 Nginx 구성 개선
- 비밀번호 해싱 방식 pbkdf2_sha256으로 변경 (bcrypt 72바이트 제한 해결)
This commit is contained in:
hyungi
2025-10-25 07:22:20 +09:00
parent 153603ed9d
commit 41b557a709
27 changed files with 1283 additions and 311 deletions

View File

@@ -225,20 +225,43 @@
</main>
<!-- Scripts -->
<script src="/static/js/api.js?v=20250917"></script>
<script>
const cacheBuster = Date.now() + Math.random() + Math.floor(Math.random() * 1000000);
const script = document.createElement('script');
script.src = `/static/js/api.js?cb=${cacheBuster}&t=${Date.now()}&r=${Math.random()}`;
script.setAttribute('cache-control', 'no-cache');
script.setAttribute('pragma', 'no-cache');
script.onload = function() {
console.log('✅ API 스크립트 로드 완료 (admin.html)');
// API 로드 후 초기화 시작
initializeAdmin();
};
document.head.appendChild(script);
</script>
<script src="/static/js/date-utils.js?v=20250917"></script>
<script>
let currentUser = null;
let users = [];
// 페이지 로드
window.addEventListener('DOMContentLoaded', async () => {
const user = TokenManager.getUser();
if (!user) {
// API 로드 후 초기화 함수
async function initializeAdmin() {
const token = localStorage.getItem('access_token');
if (!token) {
window.location.href = '/index.html';
return;
}
try {
const user = await AuthAPI.getCurrentUser();
currentUser = user;
localStorage.setItem('currentUser', JSON.stringify(user));
} catch (error) {
console.error('인증 실패:', error);
localStorage.removeItem('access_token');
localStorage.removeItem('currentUser');
window.location.href = '/index.html';
return;
}
currentUser = user;
// 관리자가 아니면 비밀번호 변경만 표시
if (currentUser.role !== 'admin') {
@@ -248,7 +271,7 @@
// 관리자면 사용자 목록 로드
await loadUsers();
}
});
}
// 사용자 추가
document.getElementById('addUserForm').addEventListener('submit', async (e) => {