383 lines
No EOL
11 KiB
HTML
383 lines
No EOL
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Login - Newsletter Admin</title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
:root {
|
|
--primary: #667eea;
|
|
--primary-dark: #5a67d8;
|
|
--secondary: #764ba2;
|
|
--success: #48bb78;
|
|
--error: #f56565;
|
|
--gray-100: #f7fafc;
|
|
--gray-200: #edf2f7;
|
|
--gray-300: #e2e8f0;
|
|
--gray-700: #4a5568;
|
|
--gray-800: #2d3748;
|
|
--white: #ffffff;
|
|
--shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
--border-radius: 8px;
|
|
--border-radius-lg: 12px;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 1rem;
|
|
}
|
|
|
|
.login-container {
|
|
background: var(--white);
|
|
border-radius: var(--border-radius-lg);
|
|
box-shadow: var(--shadow-lg);
|
|
padding: 3rem;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
text-align: center;
|
|
}
|
|
|
|
.login-header {
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.login-icon {
|
|
width: 4rem;
|
|
height: 4rem;
|
|
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 1rem;
|
|
color: white;
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.login-title {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
color: var(--gray-800);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.login-subtitle {
|
|
color: var(--gray-700);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
text-align: left;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
font-weight: 500;
|
|
color: var(--gray-700);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: 2px solid var(--gray-300);
|
|
border-radius: var(--border-radius);
|
|
font-size: 1rem;
|
|
transition: all 0.3s ease;
|
|
background: var(--white);
|
|
}
|
|
|
|
.form-input:focus {
|
|
outline: none;
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
}
|
|
|
|
.input-group {
|
|
position: relative;
|
|
}
|
|
|
|
.input-icon {
|
|
position: absolute;
|
|
left: 1rem;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
color: var(--gray-700);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.input-with-icon {
|
|
padding-left: 2.75rem;
|
|
}
|
|
|
|
.login-btn {
|
|
width: 100%;
|
|
padding: 0.875rem;
|
|
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: var(--border-radius);
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.login-btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
|
|
}
|
|
|
|
.login-btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.login-btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.flash-messages {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.flash {
|
|
padding: 1rem;
|
|
border-radius: var(--border-radius);
|
|
margin-bottom: 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
text-align: left;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.flash.success {
|
|
background: #f0fff4;
|
|
color: #22543d;
|
|
border: 1px solid #c6f6d5;
|
|
}
|
|
|
|
.flash.error {
|
|
background: #fff5f5;
|
|
color: #742a2a;
|
|
border: 1px solid #fed7d7;
|
|
}
|
|
|
|
.flash.warning {
|
|
background: #fffbeb;
|
|
color: #744210;
|
|
border: 1px solid #feebc8;
|
|
}
|
|
|
|
.flash.info {
|
|
background: #ebf8ff;
|
|
color: #2a4a5a;
|
|
border: 1px solid #bee3f8;
|
|
}
|
|
|
|
.spinner {
|
|
display: inline-block;
|
|
width: 1rem;
|
|
height: 1rem;
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
border-top: 2px solid white;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.forgot-password {
|
|
margin-top: 1.5rem;
|
|
padding-top: 1.5rem;
|
|
border-top: 1px solid var(--gray-200);
|
|
}
|
|
|
|
.forgot-password a {
|
|
color: var(--primary);
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
transition: color 0.3s ease;
|
|
}
|
|
|
|
.forgot-password a:hover {
|
|
color: var(--primary-dark);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.login-container {
|
|
padding: 2rem;
|
|
margin: 1rem;
|
|
}
|
|
|
|
.login-title {
|
|
font-size: 1.5rem;
|
|
}
|
|
}
|
|
|
|
.password-toggle {
|
|
position: absolute;
|
|
right: 1rem;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
background: none;
|
|
border: none;
|
|
color: var(--gray-700);
|
|
cursor: pointer;
|
|
padding: 0;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.password-toggle:hover {
|
|
color: var(--primary);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
<div class="login-header">
|
|
<div class="login-icon">
|
|
<i class="fas fa-envelope"></i>
|
|
</div>
|
|
<h1 class="login-title">Newsletter Admin</h1>
|
|
<p class="login-subtitle">Sign in to manage your newsletter</p>
|
|
</div>
|
|
|
|
<!-- Flash Messages -->
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
<div class="flash-messages">
|
|
{% for category, message in messages %}
|
|
<div class="flash {{ category }}">
|
|
{% if category == 'success' %}
|
|
<i class="fas fa-check-circle"></i>
|
|
{% elif category == 'error' %}
|
|
<i class="fas fa-exclamation-circle"></i>
|
|
{% elif category == 'warning' %}
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
{% else %}
|
|
<i class="fas fa-info-circle"></i>
|
|
{% endif %}
|
|
{{ message }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
<form method="POST" onsubmit="handleLogin(event)">
|
|
<div class="form-group">
|
|
<label for="username" class="form-label">Username</label>
|
|
<div class="input-group">
|
|
<i class="fas fa-user input-icon"></i>
|
|
<input type="text"
|
|
id="username"
|
|
name="username"
|
|
class="form-input input-with-icon"
|
|
placeholder="Enter your username"
|
|
required
|
|
autocomplete="username">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="password" class="form-label">Password</label>
|
|
<div class="input-group">
|
|
<i class="fas fa-lock input-icon"></i>
|
|
<input type="password"
|
|
id="password"
|
|
name="password"
|
|
class="form-input input-with-icon"
|
|
placeholder="Enter your password"
|
|
required
|
|
autocomplete="current-password">
|
|
<button type="button" class="password-toggle" onclick="togglePassword()">
|
|
<i class="fas fa-eye" id="password-icon"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="login-btn" id="login-btn">
|
|
<span id="login-text">Sign In</span>
|
|
<span id="login-spinner" class="spinner" style="display: none;"></span>
|
|
</button>
|
|
</form>
|
|
|
|
<div class="forgot-password">
|
|
<p>Having trouble signing in? Contact your administrator.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function togglePassword() {
|
|
const passwordInput = document.getElementById('password');
|
|
const passwordIcon = document.getElementById('password-icon');
|
|
|
|
if (passwordInput.type === 'password') {
|
|
passwordInput.type = 'text';
|
|
passwordIcon.className = 'fas fa-eye-slash';
|
|
} else {
|
|
passwordInput.type = 'password';
|
|
passwordIcon.className = 'fas fa-eye';
|
|
}
|
|
}
|
|
|
|
function handleLogin(event) {
|
|
const loginBtn = document.getElementById('login-btn');
|
|
const loginText = document.getElementById('login-text');
|
|
const loginSpinner = document.getElementById('login-spinner');
|
|
|
|
// Show loading state
|
|
loginBtn.disabled = true;
|
|
loginText.style.display = 'none';
|
|
loginSpinner.style.display = 'inline-block';
|
|
|
|
// Reset form state after a short delay if needed
|
|
setTimeout(() => {
|
|
if (loginBtn.disabled) {
|
|
loginBtn.disabled = false;
|
|
loginText.style.display = 'inline';
|
|
loginSpinner.style.display = 'none';
|
|
}
|
|
}, 5000);
|
|
}
|
|
|
|
// Auto-focus username field
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
document.getElementById('username').focus();
|
|
});
|
|
|
|
// Handle Enter key navigation
|
|
document.getElementById('username').addEventListener('keypress', function(e) {
|
|
if (e.key === 'Enter') {
|
|
e.preventDefault();
|
|
document.getElementById('password').focus();
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |