Files
Ninjaserver/public/adminlogin.html
2025-09-03 17:13:18 +02:00

316 lines
8.8 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Lizenzgenerator</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.login-container {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
padding: 40px;
max-width: 400px;
width: 100%;
position: relative;
overflow: hidden;
}
.login-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
background-size: 300% 100%;
animation: gradientShift 3s ease infinite;
}
@keyframes gradientShift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
h1 {
text-align: center;
color: #333;
margin-bottom: 30px;
font-size: 2em;
font-weight: 300;
letter-spacing: -1px;
}
.form-group {
margin-bottom: 25px;
position: relative;
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 500;
font-size: 0.95em;
}
input {
width: 100%;
padding: 15px 20px;
border: 2px solid #e0e0e0;
border-radius: 12px;
font-size: 1em;
transition: all 0.3s ease;
background: #fafafa;
font-family: inherit;
}
input:focus {
outline: none;
border-color: #667eea;
background: white;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
transform: translateY(-2px);
}
input:hover {
border-color: #ccc;
}
.login-btn {
width: 100%;
padding: 18px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 12px;
font-size: 1.1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 10px;
position: relative;
overflow: hidden;
}
.login-btn:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}
.login-btn:active {
transform: translateY(0);
}
.login-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
transform: none;
}
.error {
background: #ffebee;
color: #c62828;
padding: 15px;
border-radius: 8px;
margin-top: 15px;
border-left: 4px solid #f44336;
font-size: 0.9em;
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s ease;
}
.error.show {
opacity: 1;
transform: translateY(0);
}
.success {
background: #e8f5e8;
color: #2e7d32;
padding: 15px;
border-radius: 8px;
margin-top: 15px;
border-left: 4px solid #4caf50;
font-size: 0.9em;
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s ease;
}
.success.show {
opacity: 1;
transform: translateY(0);
}
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(255,255,255,.3);
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
margin-right: 10px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.info-text {
text-align: center;
color: #666;
font-size: 0.85em;
margin-top: 20px;
line-height: 1.5;
}
@media (max-width: 480px) {
.login-container {
padding: 30px 20px;
margin: 10px;
}
h1 {
font-size: 1.6em;
}
}
</style>
</head>
<body>
<div class="login-container">
<h1>🔐 Anmeldung</h1>
<form id="loginForm" onsubmit="handleLogin(event)">
<div class="form-group">
<label for="username">Benutzername</label>
<input type="text" id="username" name="username" placeholder="Ihr Benutzername" required>
</div>
<div class="form-group">
<label for="password">Passwort</label>
<input type="password" id="password" name="password" placeholder="Ihr Passwort" required>
</div>
<button type="submit" class="login-btn" id="loginBtn">
<span id="btn-text">Anmelden</span>
</button>
</form>
<div id="error" class="error"></div>
<div id="success" class="success"></div>
<div class="info-text">
Melden Sie sich an, um auf den Lizenzgenerator zuzugreifen.
</div>
</div>
<script>
function showMessage(elementId, message, isError = false) {
const messageDiv = document.getElementById(elementId);
messageDiv.textContent = message;
messageDiv.classList.add("show");
setTimeout(() => {
messageDiv.classList.remove("show");
}, 4000);
}
function showError(message) {
showMessage("error", message, true);
}
function showSuccess(message) {
showMessage("success", message, false);
}
function setLoading(isLoading) {
const btnText = document.getElementById("btn-text");
const btn = document.getElementById("loginBtn");
if (isLoading) {
btnText.innerHTML = '<span class="loading"></span>Anmelde...';
btn.disabled = true;
} else {
btnText.textContent = 'Anmelden';
btn.disabled = false;
}
}
async function handleLogin(event) {
event.preventDefault();
const username = document.getElementById('username').value.trim();
const password = document.getElementById('password').value;
if (!username || !password) {
showError('Bitte füllen Sie alle Felder aus.');
return;
}
setLoading(true);
try {
const response = await fetch('/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ username, password })
});
const result = await response.json();
if (result.success) {
showSuccess('✅ Anmeldung erfolgreich! Weiterleitung...');
setTimeout(() => {
window.location.href = '/admin-dashboard';
}, 1000);
} else {
showError(result.message || 'Anmeldung fehlgeschlagen');
}
} catch (error) {
console.error('Fehler bei der Anmeldung:', error);
showError('Verbindungsfehler. Bitte versuchen Sie es erneut.');
} finally {
setLoading(false);
}
}
// Enter-Taste für Login
document.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
handleLogin(e);
}
});
// Fokus auf erstes Eingabefeld
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('username').focus();
});
</script>
</body>
</html>