332 lines
9.6 KiB
HTML
332 lines
9.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Sign In</title>
|
|
<style>
|
|
:root {
|
|
--primary: #0284c7;
|
|
--primary-hover: #0369a1;
|
|
--primary-focus-ring: rgba(2, 132, 199, 0.2);
|
|
--surface: #ffffff;
|
|
--background: #f8fafc;
|
|
--border: #e2e8f0;
|
|
--border-focus: #0284c7;
|
|
--text-primary: #0f172a;
|
|
--text-secondary: #475569;
|
|
--text-muted: #64748b;
|
|
--danger: #dc2626;
|
|
--danger-bg: #fef2f2;
|
|
--danger-border: #fecaca;
|
|
--success: #059669;
|
|
--success-bg: #ecfdf5;
|
|
--success-border: #a7f3d0;
|
|
--radius: 8px;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background-color: var(--background);
|
|
color: var(--text-primary);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 24px 16px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.auth-card {
|
|
background-color: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
|
|
width: 100%;
|
|
max-width: 420px;
|
|
padding: 40px 32px;
|
|
}
|
|
|
|
/* Dedicated Logo Placeholder Area */
|
|
.logo-placeholder-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.logo-placeholder {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.logo-placeholder img {
|
|
max-height: 72px;
|
|
height: 68px;
|
|
width: auto;
|
|
object-fit: contain;
|
|
display: block;
|
|
}
|
|
|
|
.auth-header {
|
|
text-align: center;
|
|
margin-bottom: 32px;
|
|
}
|
|
|
|
.auth-header h1 {
|
|
font-size: 20px;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
letter-spacing: -0.01em;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.auth-header p {
|
|
font-size: 14px;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 6px;
|
|
color: var(--text-primary);
|
|
font-weight: 500;
|
|
font-size: 13px;
|
|
}
|
|
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 10px 14px;
|
|
border: 1px solid #cbd5e1;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
color: var(--text-primary);
|
|
background-color: #ffffff;
|
|
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
font-family: inherit;
|
|
}
|
|
|
|
input[type="text"]:focus,
|
|
input[type="password"]:focus {
|
|
outline: none;
|
|
border-color: var(--border-focus);
|
|
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
}
|
|
|
|
.submit-btn {
|
|
width: 100%;
|
|
padding: 11px 16px;
|
|
background-color: var(--primary);
|
|
color: #ffffff;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background-color 0.15s ease;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.submit-btn:hover {
|
|
background-color: var(--primary-hover);
|
|
}
|
|
|
|
.submit-btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.links-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-top: 16px;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.links-row a,
|
|
.auth-footer a {
|
|
color: var(--primary);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.links-row a:hover,
|
|
.auth-footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.auth-footer {
|
|
text-align: center;
|
|
margin-top: 28px;
|
|
padding-top: 20px;
|
|
border-top: 1px solid var(--border);
|
|
font-size: 13px;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.message {
|
|
padding: 10px 14px;
|
|
border-radius: 6px;
|
|
margin-bottom: 20px;
|
|
font-size: 13px;
|
|
display: none;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.message.error {
|
|
background-color: var(--danger-bg);
|
|
color: var(--danger);
|
|
border: 1px solid var(--danger-border);
|
|
display: block;
|
|
}
|
|
|
|
.message.success {
|
|
background-color: var(--success-bg);
|
|
color: var(--success);
|
|
border: 1px solid var(--success-border);
|
|
display: block;
|
|
}
|
|
|
|
.loading {
|
|
display: none;
|
|
text-align: center;
|
|
color: var(--text-secondary);
|
|
font-size: 13px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.spinner {
|
|
display: inline-block;
|
|
width: 14px;
|
|
height: 14px;
|
|
border: 2px solid var(--border);
|
|
border-top: 2px solid var(--primary);
|
|
border-radius: 50%;
|
|
animation: spin 0.6s linear infinite;
|
|
margin-right: 8px;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.auth-card {
|
|
padding: 28px 20px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="auth-card">
|
|
<div class="logo-placeholder-container">
|
|
<div class="logo-placeholder" id="logoPlaceholder">
|
|
<img src="{{ url_for('static', filename='logo.png') }}" alt="Logo">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="auth-header">
|
|
<h1>Sign In</h1>
|
|
<p>Access your management dashboard</p>
|
|
</div>
|
|
|
|
<div id="message" class="message"></div>
|
|
|
|
<form id="loginForm">
|
|
<div class="form-group">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" placeholder="Enter username" autocomplete="username" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" placeholder="Enter password" autocomplete="current-password" required>
|
|
</div>
|
|
|
|
<div class="loading" id="loading">
|
|
<span class="spinner"></span>
|
|
Authenticating...
|
|
</div>
|
|
|
|
<button type="submit" class="submit-btn" id="submitBtn">Sign In</button>
|
|
</form>
|
|
|
|
<div class="links-row">
|
|
<a href="#" onclick="showForgot(event)">Forgot password?</a>
|
|
</div>
|
|
|
|
<div class="auth-footer">
|
|
Do not have an account? <a href="/register">Register</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('loginForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
|
|
const username = document.getElementById('username').value.trim();
|
|
const password = document.getElementById('password').value;
|
|
const messageDiv = document.getElementById('message');
|
|
const loading = document.getElementById('loading');
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
|
|
if (!username || !password) {
|
|
showMessage('Please fill in all fields', 'error');
|
|
return;
|
|
}
|
|
|
|
loading.style.display = 'block';
|
|
submitBtn.disabled = true;
|
|
|
|
try {
|
|
const response = await fetch('/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ username, password })
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (response.ok) {
|
|
showMessage('Sign in successful. Redirecting...', 'success');
|
|
setTimeout(() => {
|
|
window.location.href = '/dashboard';
|
|
}, 800);
|
|
} else {
|
|
showMessage(data.message || 'Invalid username or password', 'error');
|
|
}
|
|
} catch (error) {
|
|
showMessage('Connection error. Please try again.', 'error');
|
|
} finally {
|
|
loading.style.display = 'none';
|
|
submitBtn.disabled = false;
|
|
}
|
|
});
|
|
|
|
function showMessage(text, type) {
|
|
const messageDiv = document.getElementById('message');
|
|
messageDiv.textContent = text;
|
|
messageDiv.className = `message ${type}`;
|
|
}
|
|
|
|
function showForgot(e) {
|
|
if (e) e.preventDefault();
|
|
alert('Password reset assistance is managed by the system administrator. Please contact your administrative team.');
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |