<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SOAR MCP Server - 管理员登录</title>
<link rel="stylesheet" href="/static/fonts/fonts.css">
<style>
:root {
--bg-deep: #0a0e1a;
--bg-surface: #111827;
--bg-card: rgba(17, 24, 39, 0.7);
--border-subtle: rgba(99, 102, 241, 0.15);
--border-glow: rgba(99, 102, 241, 0.4);
--accent-primary: #6366f1;
--accent-cyan: #22d3ee;
--accent-emerald: #34d399;
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html {
height: 100%;
font-family: var(--font-sans);
overflow: hidden;
background: var(--bg-deep);
color: var(--text-primary);
}
/* --- 背景层 --- */
.scene {
position: fixed;
inset: 0;
z-index: 0;
overflow: hidden;
}
/* 微妙点阵网格 */
.scene::before {
content: '';
position: absolute;
inset: 0;
background-image:
radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.08) 1px, transparent 0);
background-size: 32px 32px;
}
/* 柔和辉光 */
.glow {
position: absolute;
border-radius: 50%;
filter: blur(100px);
opacity: 0.35;
animation: drift 20s ease-in-out infinite alternate;
}
.glow--indigo {
width: 500px;
height: 500px;
background: var(--accent-primary);
top: -10%;
right: -5%;
}
.glow--cyan {
width: 400px;
height: 400px;
background: var(--accent-cyan);
bottom: -15%;
left: -8%;
animation-delay: -8s;
opacity: 0.2;
}
.glow--emerald {
width: 300px;
height: 300px;
background: var(--accent-emerald);
top: 50%;
left: 60%;
animation-delay: -14s;
opacity: 0.12;
}
@keyframes drift {
0% { transform: translate(0, 0) scale(1); }
50% { transform: translate(30px, -20px) scale(1.1); }
100% { transform: translate(-20px, 15px) scale(0.95); }
}
/* 扫描线 */
.scanline {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(90deg,
transparent 0%,
rgba(99, 102, 241, 0.3) 30%,
rgba(34, 211, 238, 0.5) 50%,
rgba(99, 102, 241, 0.3) 70%,
transparent 100%);
animation: scan 8s linear infinite;
opacity: 0.6;
}
@keyframes scan {
0% { top: -2px; }
100% { top: 100%; }
}
/* --- 主容器 --- */
.viewport {
position: relative;
z-index: 1;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
}
/* --- 登录卡片 --- */
.login-card {
width: 100%;
max-width: 420px;
background: var(--bg-card);
backdrop-filter: blur(24px) saturate(1.4);
border: 1px solid var(--border-subtle);
border-radius: 20px;
padding: 2.5rem 2rem;
position: relative;
animation: cardEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cardEnter {
from {
opacity: 0;
transform: translateY(24px) scale(0.96);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* 顶部色带 */
.login-card::before {
content: '';
position: absolute;
top: 0;
left: 24px;
right: 24px;
height: 3px;
background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan), var(--accent-emerald));
border-radius: 0 0 3px 3px;
}
/* 外层微光 */
.login-card::after {
content: '';
position: absolute;
inset: -1px;
border-radius: 21px;
background: linear-gradient(135deg,
rgba(99, 102, 241, 0.1),
transparent 40%,
transparent 60%,
rgba(34, 211, 238, 0.08));
z-index: -1;
pointer-events: none;
}
/* --- Logo & 标题 --- */
.brand {
text-align: center;
margin-bottom: 2rem;
}
.brand__logo {
display: inline-flex;
align-items: center;
gap: 12px;
margin-bottom: 0.75rem;
}
.brand__logo img {
width: 44px;
height: 44px;
border-radius: 12px;
border: 1px solid var(--border-subtle);
box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}
.brand__name {
font-size: 1.6rem;
font-weight: 800;
letter-spacing: -0.03em;
background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-cyan) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.brand__sub {
font-size: 0.875rem;
color: var(--text-muted);
font-weight: 500;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/* --- 提示条 --- */
.hint-bar {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
background: rgba(99, 102, 241, 0.08);
border: 1px solid rgba(99, 102, 241, 0.12);
border-radius: 10px;
margin-bottom: 1.5rem;
font-size: 0.8rem;
color: var(--text-secondary);
line-height: 1.5;
}
.hint-bar__icon {
font-size: 1rem;
flex-shrink: 0;
}
/* --- 消息 --- */
.msg {
padding: 10px 14px;
border-radius: 10px;
margin-bottom: 1rem;
font-size: 0.85rem;
font-weight: 500;
display: none;
animation: msgIn 0.3s ease;
}
@keyframes msgIn {
from { opacity: 0; transform: translateY(-4px); }
to { opacity: 1; transform: translateY(0); }
}
.msg--error {
background: rgba(239, 68, 68, 0.1);
color: #fca5a5;
border: 1px solid rgba(239, 68, 68, 0.2);
}
.msg--success {
background: rgba(52, 211, 153, 0.1);
color: #6ee7b7;
border: 1px solid rgba(52, 211, 153, 0.2);
}
/* --- 表单 --- */
.field {
margin-bottom: 1.25rem;
}
.field__label {
display: block;
margin-bottom: 6px;
font-size: 0.8rem;
font-weight: 600;
color: var(--text-secondary);
letter-spacing: 0.02em;
text-transform: uppercase;
}
.field__input {
width: 100%;
padding: 13px 16px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid var(--border-subtle);
border-radius: 12px;
font-family: var(--font-sans);
font-size: 0.95rem;
font-weight: 500;
color: var(--text-primary);
transition: all 0.25s ease;
outline: none;
}
.field__input::placeholder {
color: var(--text-muted);
font-weight: 400;
}
.field__input:focus {
border-color: var(--accent-primary);
background: rgba(99, 102, 241, 0.04);
box-shadow:
0 0 0 3px rgba(99, 102, 241, 0.08),
0 4px 20px rgba(99, 102, 241, 0.06);
}
/* --- 按钮 --- */
.btn-login {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, var(--accent-primary), #818cf8);
border: none;
border-radius: 12px;
color: white;
font-family: var(--font-sans);
font-size: 0.95rem;
font-weight: 700;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
letter-spacing: 0.02em;
}
.btn-login:hover {
transform: translateY(-2px);
box-shadow:
0 8px 24px rgba(99, 102, 241, 0.35),
0 2px 8px rgba(99, 102, 241, 0.2);
}
.btn-login:active {
transform: translateY(0);
}
.btn-login:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
/* 按钮微光 */
.btn-login::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
transition: left 0.6s ease;
}
.btn-login:hover::before {
left: 100%;
}
/* --- Loading --- */
.spinner {
display: inline-block;
width: 18px;
height: 18px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.7s linear infinite;
margin-right: 8px;
vertical-align: middle;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* --- 底栏 --- */
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 14px 0;
text-align: center;
background: rgba(10, 14, 26, 0.8);
backdrop-filter: blur(12px);
border-top: 1px solid var(--border-subtle);
z-index: 10;
}
.footer__text {
font-size: 0.78rem;
color: var(--text-muted);
font-weight: 500;
}
.footer__text a {
color: var(--accent-cyan);
text-decoration: none;
font-weight: 600;
margin: 0 6px;
transition: color 0.2s ease;
}
.footer__text a:hover {
color: var(--accent-primary);
}
/* --- Responsive --- */
@media (max-width: 480px) {
.login-card {
padding: 2rem 1.5rem;
border-radius: 16px;
}
.brand__name {
font-size: 1.3rem;
}
}
</style>
</head>
<body>
<!-- 背景场景 -->
<div class="scene">
<div class="glow glow--indigo"></div>
<div class="glow glow--cyan"></div>
<div class="glow glow--emerald"></div>
<div class="scanline"></div>
</div>
<!-- 主体 -->
<div class="viewport">
<div class="login-card">
<div class="brand">
<div class="brand__logo">
<img src="/static/logo.webp" alt="SOAR MCP Server">
<span class="brand__name">SOAR MCP Server</span>
</div>
<div class="brand__sub">Security Orchestration Console</div>
</div>
<div class="hint-bar">
<span class="hint-bar__icon">🔑</span>
<span>请从服务器启动日志中获取管理员密码进行登录</span>
</div>
<div class="msg msg--error" id="errorMessage"></div>
<div class="msg msg--success" id="successMessage"></div>
<form id="loginForm" autocomplete="off">
<div class="field">
<label class="field__label" for="adminPassword">管理员密码</label>
<input
class="field__input"
type="password"
id="adminPassword"
name="adminPassword"
required
placeholder="输入管理员密码"
maxlength="100"
autofocus>
</div>
<button type="submit" class="btn-login" id="loginBtn">
登 录
</button>
</form>
</div>
</div>
<!-- 底栏 -->
<footer class="footer">
<div class="footer__text">
雾帜智能 © 2025
<a href="https://flagify.com" target="_blank">Flagify</a>
<a href="https://github.com/flagify-com/OctoMation/wiki" target="_blank">OctoMation</a>
·
<a href="https://github.com/flagify-com/soar-mcp" target="_blank">GitHub</a>
</div>
</footer>
<script>
const loginForm = document.getElementById('loginForm');
const loginBtn = document.getElementById('loginBtn');
const errorMessage = document.getElementById('errorMessage');
const successMessage = document.getElementById('successMessage');
const adminPasswordInput = document.getElementById('adminPassword');
function showError(message) {
errorMessage.textContent = message;
errorMessage.style.display = 'block';
successMessage.style.display = 'none';
}
function showSuccess(message) {
successMessage.textContent = message;
successMessage.style.display = 'block';
errorMessage.style.display = 'none';
}
function hideMessages() {
errorMessage.style.display = 'none';
successMessage.style.display = 'none';
}
function setLoading(loading) {
if (loading) {
loginBtn.disabled = true;
loginBtn.innerHTML = '<span class="spinner"></span>登录中…';
} else {
loginBtn.disabled = false;
loginBtn.innerHTML = '登 录';
}
}
loginForm.addEventListener('submit', async function(e) {
e.preventDefault();
const adminPassword = adminPasswordInput.value.trim();
if (!adminPassword) {
showError('请输入管理员密码');
return;
}
hideMessages();
setLoading(true);
try {
const response = await fetch('/api/admin/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ adminPassword })
});
const data = await response.json();
if (response.ok && data.success) {
localStorage.setItem('jwt_token', data.jwt);
showSuccess('登录成功,即将跳转…');
setTimeout(() => { window.location.href = '/admin'; }, 1500);
} else {
showError(data.error || '登录失败,请检查密码是否正确');
}
} catch (error) {
console.error('Login error:', error);
showError('登录过程中发生错误,请重试');
} finally {
setLoading(false);
}
});
// 自动登录检测
window.addEventListener('load', function() {
const jwt = localStorage.getItem('jwt_token');
if (jwt) {
fetch('/api/admin/verify', {
headers: { 'Authorization': `Bearer ${jwt}` }
}).then(response => {
if (response.ok) {
window.location.href = '/admin';
} else {
localStorage.removeItem('jwt_token');
}
}).catch(() => {
localStorage.removeItem('jwt_token');
});
}
});
adminPasswordInput.addEventListener('focus', hideMessages);
</script>
</body>
</html>