초기 커밋: 인증 서버 분리
0bin-label-app 프로젝트의 auth 폴더에서 별도 리포지토리로 분리. Flask 기반 로그인 인증 서버: - POST /api/login: 클라이언트 로그인 API - GET /api/health: 서버 상태 확인 - /admin: 관리자 웹 페이지 - SQLite 기반 사용자 및 로그인 기록 저장 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
199
templates/dashboard.html
Normal file
199
templates/dashboard.html
Normal file
@@ -0,0 +1,199 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>0bin Label App - Admin 대시보드</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.navbar {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #2196F3 100%);
|
||||
}
|
||||
.stats-card {
|
||||
border-left: 4px solid;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.stats-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
.stats-card.users {
|
||||
border-left-color: #4CAF50;
|
||||
}
|
||||
.stats-card.success {
|
||||
border-left-color: #2196F3;
|
||||
}
|
||||
.stats-card.failed {
|
||||
border-left-color: #f44336;
|
||||
}
|
||||
.table-container {
|
||||
background: white;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
.badge-success-log {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
.badge-failed-log {
|
||||
background-color: #f44336;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-dark mb-4">
|
||||
<div class="container-fluid">
|
||||
<span class="navbar-brand mb-0 h1">
|
||||
<i class="fas fa-tag"></i> 청춘라벨 - 관리자 대시보드
|
||||
</span>
|
||||
<div>
|
||||
<span class="text-white me-3">
|
||||
<i class="fas fa-user"></i> {{ session.admin_username }}
|
||||
</span>
|
||||
<a href="{{ url_for('admin_logout') }}" class="btn btn-outline-light btn-sm">
|
||||
<i class="fas fa-sign-out-alt"></i> 로그아웃
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid">
|
||||
<!-- 통계 카드 -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card stats-card users">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h6 class="text-muted mb-2">총 사용자</h6>
|
||||
<h2 class="mb-0">{{ total_users }}</h2>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
<i class="fas fa-users fa-3x"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card stats-card success">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h6 class="text-muted mb-2">성공한 로그인</h6>
|
||||
<h2 class="mb-0">{{ total_logins }}</h2>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
<i class="fas fa-check-circle fa-3x"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card stats-card failed">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h6 class="text-muted mb-2">실패한 로그인</h6>
|
||||
<h2 class="mb-0">{{ failed_logins }}</h2>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
<i class="fas fa-times-circle fa-3x"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 사용자 목록 -->
|
||||
<div class="table-container mb-4">
|
||||
<h4 class="mb-3">
|
||||
<i class="fas fa-users"></i> 사용자 목록
|
||||
</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>아이디</th>
|
||||
<th>생성일</th>
|
||||
<th>활성 상태</th>
|
||||
<th>로그인 횟수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{ user.id }}</td>
|
||||
<td><strong>{{ user.username }}</strong></td>
|
||||
<td>{{ user.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||
<td>
|
||||
{% if user.is_active %}
|
||||
<span class="badge bg-success">활성</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">비활성</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-primary">
|
||||
{{ user.login_logs|selectattr('success')|list|length }}회
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 최근 로그인 기록 -->
|
||||
<div class="table-container">
|
||||
<h4 class="mb-3">
|
||||
<i class="fas fa-history"></i> 최근 로그인 기록 (최대 50개)
|
||||
</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>시간</th>
|
||||
<th>사용자</th>
|
||||
<th>IP 주소</th>
|
||||
<th>User Agent</th>
|
||||
<th>결과</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in recent_logs %}
|
||||
<tr>
|
||||
<td>{{ log.login_time.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
<td><strong>{{ log.user.username }}</strong></td>
|
||||
<td><code>{{ log.ip_address }}</code></td>
|
||||
<td>
|
||||
<small class="text-muted">
|
||||
{{ log.user_agent[:50] }}{% if log.user_agent|length > 50 %}...{% endif %}
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
{% if log.success %}
|
||||
<span class="badge badge-success-log">성공</span>
|
||||
{% else %}
|
||||
<span class="badge badge-failed-log">실패</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
91
templates/login.html
Normal file
91
templates/login.html
Normal file
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>0bin Label App - Admin 로그인</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #2196F3 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.login-card {
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
|
||||
overflow: hidden;
|
||||
}
|
||||
.login-header {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #2196F3 100%);
|
||||
color: white;
|
||||
padding: 30px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.login-header h1 {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
.login-header p {
|
||||
margin: 10px 0 0 0;
|
||||
opacity: 0.95;
|
||||
}
|
||||
.login-body {
|
||||
padding: 30px;
|
||||
}
|
||||
.btn-login {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.btn-login:hover {
|
||||
background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<div class="login-header">
|
||||
<h1>청춘라벨</h1>
|
||||
<p>관리자 로그인</p>
|
||||
</div>
|
||||
<div class="login-body">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="POST" action="{{ url_for('admin_login_post') }}">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">아이디</label>
|
||||
<input type="text" class="form-control" id="username" name="username" required autofocus>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">비밀번호</label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-login">로그인</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr class="my-4">
|
||||
<p class="text-center text-muted small mb-0">
|
||||
© 2026 0bin Label App v1.0
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user