Paralleles WebGUI mit Kestrel, Token-Sicherung und SSE-Logs implementiert
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PolyTrader — WebUI Login</title>
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
background-color: var(--bg);
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
color: var(--text);
|
||||
}
|
||||
.login-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 32px 28px;
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.brand-icon {
|
||||
font-size: 28px;
|
||||
}
|
||||
.brand-title {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
.brand-sub {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
.alert {
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.alert-error {
|
||||
background: rgba(243, 139, 168, 0.15);
|
||||
border: 1px solid var(--negative);
|
||||
color: var(--negative);
|
||||
}
|
||||
.alert-warning {
|
||||
background: rgba(249, 226, 175, 0.15);
|
||||
border: 1px solid var(--warning);
|
||||
color: var(--warning);
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.input-group {
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
input[type="text"], input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
background: var(--surface-alt);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input:focus {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
button.btn-primary {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: var(--accent);
|
||||
color: #11111b;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
button.btn-primary:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
button.btn-primary:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.footer-note {
|
||||
margin-top: 20px;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<div class="brand">
|
||||
<div class="brand-icon">📈</div>
|
||||
<div>
|
||||
<div class="brand-title">PolyTrader Web</div>
|
||||
<div class="brand-sub">Zugangssicherung & Steuerung</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="alertBox" class="alert"></div>
|
||||
|
||||
<form id="loginForm" onsubmit="handleLogin(event)">
|
||||
<div class="form-group">
|
||||
<label for="tokenInput">Zugangs-Token</label>
|
||||
<div class="input-group">
|
||||
<input type="password" id="tokenInput" placeholder="Token eingeben oder einfügen …" autocomplete="current-password" autofocus required>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" id="submitBtn" class="btn-primary">Anmelden</button>
|
||||
</form>
|
||||
|
||||
<div class="footer-note">
|
||||
Das Token ist in <code style="color:var(--accent);">appsettings.Local.json</code> hinterlegt und kann im Desktop-GUI unter <b>Einstellungen → WebUI</b> angezeigt und neu generiert werden.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// URL-Parameter prüfen
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const alertBox = document.getElementById('alertBox');
|
||||
|
||||
if (urlParams.get('error') === 'no_token') {
|
||||
alertBox.textContent = '⚠️ Es ist kein Zugangs-Token im System hinterlegt. Bitte generiere zuerst ein Token in den Desktop-Einstellungen oder trage es in appsettings.Local.json ein.';
|
||||
alertBox.className = 'alert alert-warning';
|
||||
alertBox.style.display = 'block';
|
||||
}
|
||||
|
||||
async function handleLogin(e) {
|
||||
e.preventDefault();
|
||||
const token = document.getElementById('tokenInput').value.trim();
|
||||
const btn = document.getElementById('submitBtn');
|
||||
|
||||
if (!token) return;
|
||||
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Prüfe …';
|
||||
alertBox.style.display = 'none';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ token })
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = '/';
|
||||
} else {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
alertBox.textContent = data.error || 'Ungültiges Zugangs-Token.';
|
||||
alertBox.className = 'alert alert-error';
|
||||
alertBox.style.display = 'block';
|
||||
}
|
||||
} catch (err) {
|
||||
alertBox.textContent = 'Verbindungsfehler zum Server.';
|
||||
alertBox.className = 'alert alert-error';
|
||||
alertBox.style.display = 'block';
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Anmelden';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user