Files
uldp-degree-mangement-system/views/auth/login.ejs
2026-04-11 14:08:27 +07:00

271 lines
8.2 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= title %> | ULDP Management</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/assets/css/variables.css">
<style>
body {
font-family: var(--font-family);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 55%, var(--primary-light) 100%);
position: relative;
overflow: hidden;
}
body::before {
content: '';
position: absolute;
inset: 0;
background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-wrapper {
width: 100%;
max-width: 420px;
padding: 1.25rem;
position: relative;
z-index: 1;
}
.login-card {
background: #fff;
border-radius: var(--border-radius-lg);
box-shadow: 0 20px 60px rgba(0,0,0,0.25);
overflow: hidden;
}
.login-header {
background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
padding: 2rem 2rem 1.5rem;
text-align: center;
}
.login-logo {
width: 150px;
height: 100%;
border-radius: 14px;
/* background: rgba(255,255,255,0.15); */
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1rem;
backdrop-filter: blur(4px);
}
.login-logo img {
width: 40px;
height: 40px;
object-fit: contain;
filter: brightness(0) invert(1);
}
.login-title {
color: #fff;
font-size: 1.2rem;
font-weight: 700;
margin: 0 0 0.25rem;
}
.login-subtitle {
color: rgba(255,255,255,0.65);
font-size: 0.8125rem;
margin: 0;
}
.login-body { padding: 1.75rem 2rem 2rem; }
.form-label {
font-weight: 600;
font-size: 0.8125rem;
color: var(--text-main);
margin-bottom: 0.35rem;
}
.form-control {
border: 1px solid var(--border-color);
border-radius: var(--border-radius-sm);
padding: 0.6rem 0.875rem;
font-size: 0.9rem;
transition: var(--transition-base);
height: 42px;
}
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(10,35,71,0.08);
outline: none;
}
.password-wrapper { position: relative; }
.password-toggle {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
border: none;
background: none;
color: var(--text-muted);
cursor: pointer;
padding: 0;
font-size: 0.9rem;
z-index: 5;
}
.password-toggle:hover { color: var(--primary-color); }
.btn-login {
background: var(--primary-color);
color: #fff;
border: none;
width: 100%;
height: 44px;
border-radius: var(--border-radius-sm);
font-weight: 600;
font-size: 0.9rem;
cursor: pointer;
transition: var(--transition-base);
letter-spacing: 0.02em;
position: relative;
overflow: hidden;
}
.btn-login:hover {
background: var(--primary-light);
transform: translateY(-1px);
box-shadow: 0 6px 20px rgba(10,35,71,0.3);
}
.accent-link {
color: var(--accent-color);
font-weight: 600;
text-decoration: none;
font-size: 0.8125rem;
}
.accent-link:hover { color: var(--accent-light); }
.login-footer {
text-align: center;
margin-top: 1.25rem;
}
.login-footer p {
font-size: 0.75rem;
color: rgba(255,255,255,0.45);
margin: 0;
}
.toast-area {
position: fixed;
top: 1rem;
right: 1rem;
z-index: 9999;
}
</style>
</head>
<body>
<% if(typeof success_msg !== 'undefined' || typeof error_msg !== 'undefined' || typeof error !== 'undefined') { %>
<div id="flash-messages-data" style="display:none;"><%- JSON.stringify({
success_msg: typeof success_msg !== 'undefined' && success_msg ? success_msg : null,
error_msg: typeof error_msg !== 'undefined' && error_msg ? error_msg : null,
error: typeof error !== 'undefined' && error ? error : null
}) %></div>
<% } %>
<div class="login-wrapper">
<div class="login-card">
<div class="login-header">
<div class="login-logo">
<img src="/img/logo.png" alt="ULDP Logo" style="width:100%;height:100%;object-fit:contain;filter:none;border-radius:0;">
</div>
<p class="login-subtitle">Sign in to your account</p>
</div>
<div class="login-body">
<form action="/auth/login" method="POST">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required autocomplete="username" autofocus>
</div>
<div class="mb-3">
<div class="d-flex justify-content-between align-items-center mb-1">
<label for="password" class="form-label mb-0">Password</label>
<a href="/auth/change-password" class="accent-link">Change Password?</a>
</div>
<div class="password-wrapper">
<input type="password" class="form-control" id="password" name="password" required autocomplete="current-password" style="padding-right:2.5rem">
<button type="button" class="password-toggle" id="togglePassword" aria-label="Toggle password">
<i class="fas fa-eye"></i>
</button>
</div>
</div>
<div class="mt-4">
<button type="submit" class="btn-login">
<i class="fas fa-sign-in-alt me-2"></i>Sign In
</button>
</div>
<div class="text-center mt-3">
<span style="font-size:0.8125rem;color:var(--text-muted)">Don't have an account?</span>
<a href="/auth/register" class="accent-link ms-1">Create Account</a>
</div>
</form>
</div>
</div>
<div class="login-footer">
<p>&copy; <%= new Date().getFullYear() %> ULDP Management System. All rights reserved.</p>
</div>
</div>
<div class="toast-area" id="toastArea"></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Password toggle
document.getElementById('togglePassword').addEventListener('click', function() {
const pwd = document.getElementById('password');
const icon = this.querySelector('i');
if (pwd.type === 'password') {
pwd.type = 'text';
icon.className = 'fas fa-eye-slash';
} else {
pwd.type = 'password';
icon.className = 'fas fa-eye';
}
});
// Flash messages
const flashData = document.getElementById('flash-messages-data');
if (flashData) {
try {
const msgs = JSON.parse(flashData.textContent);
const area = document.getElementById('toastArea');
const show = (msg, type) => {
if (!msg) return;
const t = document.createElement('div');
t.className = `toast align-items-center text-bg-${type} border-0 show mb-2`;
t.innerHTML = `<div class="d-flex"><div class="toast-body">${msg}</div><button type="button" class="btn-close btn-close-white me-2 m-auto" onclick="this.closest('.toast').remove()"></button></div>`;
area.appendChild(t);
setTimeout(() => t.remove(), 4500);
};
show(msgs.success_msg, 'success');
show(msgs.error_msg, 'danger');
show(msgs.error, 'danger');
} catch(e) {}
}
</script>
</body>
</html>