Files
akiyama-manga/web/frontend/templates/signin.html
T

509 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover, user-scalable=no">
<meta name="theme-color" content="#09090b">
<title>Sign In - Akiyama Manga</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📖</text></svg>">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--background: #09090b;
--foreground: #fafafa;
--card: #18181b;
--border: #27272a;
--primary: #3b82f6;
--primary-hover: #2563eb;
--muted-foreground: #a1a1a1;
--accent: #ec4899;
--error: #ef4444;
}
html, body {
width: 100%;
height: 100%;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: var(--background);
color: var(--foreground);
line-height: 1.6;
display: flex;
flex-direction: column;
}
/* Header */
header {
position: sticky;
top: 0;
z-index: 50;
width: 100%;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
background-color: rgba(9, 9, 11, 0.8);
backdrop-filter: blur(12px);
}
.container {
max-width: 1280px;
margin: 0 auto;
padding: 0 1rem;
width: 100%;
}
.header-content {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem 0;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: bold;
font-size: 1.125rem;
text-decoration: none;
color: var(--foreground);
flex-shrink: 0;
}
.logo-icon {
width: 2rem;
height: 2rem;
border-radius: 0.5rem;
background: linear-gradient(135deg, #3b82f6, #ec4899);
display: flex;
align-items: center;
justify-content: center;
font-size: 1rem;
color: white;
}
/* Main Content */
main {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem 1rem;
}
.auth-wrapper {
width: 100%;
max-width: 420px;
}
.auth-card {
background-color: rgba(24, 24, 27, 0.5);
border: 1px solid var(--border);
border-radius: 1rem;
padding: 2rem;
backdrop-filter: blur(4px);
}
.auth-header {
text-align: center;
margin-bottom: 2rem;
}
.auth-title {
font-size: 1.875rem;
font-weight: bold;
margin-bottom: 0.5rem;
color: var(--foreground);
}
.auth-subtitle {
color: var(--muted-foreground);
font-size: 0.875rem;
}
.form-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
color: var(--foreground);
}
input[type="email"],
input[type="password"],
input[type="text"] {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid var(--border);
border-radius: 0.5rem;
background-color: rgba(0, 0, 0, 0.2);
color: var(--foreground);
font-size: 0.875rem;
transition: all 0.2s;
}
input[type="email"]:hover,
input[type="password"]:hover,
input[type="text"]:hover {
background-color: rgba(0, 0, 0, 0.3);
border-color: var(--border);
}
input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
outline: none;
background-color: rgba(0, 0, 0, 0.3);
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-options {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.5rem;
font-size: 0.875rem;
}
.remember-me {
display: flex;
align-items: center;
gap: 0.5rem;
}
.remember-me input[type="checkbox"] {
cursor: pointer;
accent-color: var(--primary);
}
.remember-me label {
margin: 0;
cursor: pointer;
color: var(--muted-foreground);
}
.forgot-password {
color: var(--primary);
text-decoration: none;
transition: color 0.2s;
}
.forgot-password:hover {
color: var(--primary-hover);
}
.btn {
width: 100%;
padding: 0.75rem 1rem;
border: none;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-primary {
background-color: var(--primary);
color: white;
margin-bottom: 1rem;
}
.btn-primary:hover {
background-color: var(--primary-hover);
}
.btn-primary:active {
transform: scale(0.98);
}
.btn-secondary {
background-color: rgba(255, 255, 255, 0.05);
color: var(--foreground);
border: 1px solid var(--border);
margin-bottom: 1.5rem;
}
.btn-secondary:hover {
background-color: rgba(255, 255, 255, 0.1);
border-color: var(--primary);
}
.auth-divider {
position: relative;
margin: 1.5rem 0;
text-align: center;
font-size: 0.75rem;
color: var(--muted-foreground);
}
.auth-divider::before {
content: '';
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 1px;
background-color: var(--border);
}
.auth-divider span {
position: relative;
background-color: rgba(24, 24, 27, 0.5);
padding: 0 0.5rem;
}
.auth-footer {
text-align: center;
margin-top: 1.5rem;
font-size: 0.875rem;
color: var(--muted-foreground);
}
.auth-footer a {
color: var(--primary);
text-decoration: none;
transition: color 0.2s;
}
.auth-footer a:hover {
color: var(--primary-hover);
}
.error-message {
display: none;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
background-color: rgba(239, 68, 68, 0.1);
border: 1px solid var(--error);
color: #fca5a5;
font-size: 0.875rem;
margin-bottom: 1rem;
}
.error-message.show {
display: block;
}
.success-message {
display: none;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
background-color: rgba(34, 197, 94, 0.1);
border: 1px solid #22c55e;
color: #86efac;
font-size: 0.875rem;
margin-bottom: 1rem;
}
.success-message.show {
display: block;
}
/* Footer */
footer {
border-top: 1px solid var(--border);
padding: 2rem 1rem;
margin-top: auto;
color: var(--muted-foreground);
font-size: 0.875rem;
}
.footer-content {
display: flex;
flex-direction: column;
gap: 1rem;
align-items: center;
text-align: center;
}
.footer-links {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
list-style: none;
justify-content: center;
}
.footer-links a {
color: var(--muted-foreground);
text-decoration: none;
transition: color 0.2s;
}
.footer-links a:hover {
color: var(--foreground);
}
.loading {
opacity: 0.6;
pointer-events: none;
}
</style>
</head>
<body>
<!-- Navigation Header -->
<header>
<div class="container">
<div class="header-content">
<a href="/" class="logo">
<div class="logo-icon">📖</div>
<span>Akiyama</span>
</a>
</div>
</div>
</header>
<!-- Main Content -->
<main>
<div class="auth-wrapper">
<div class="auth-card">
<div class="auth-header">
<h1 class="auth-title">Welcome Back</h1>
<p class="auth-subtitle">Sign in to your Akiyama account</p>
</div>
<div id="successMessage" class="success-message"></div>
<div id="errorMessage" class="error-message"></div>
<form id="signInForm">
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" placeholder="you@example.com" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="••••••••" required>
</div>
<div class="form-options">
<div class="remember-me">
<input type="checkbox" id="remember" name="remember">
<label for="remember">Remember me</label>
</div>
<a href="/forgot-password" class="forgot-password">Forgot password?</a>
</div>
<button type="submit" class="btn btn-primary">Sign In</button>
</form>
<div class="auth-divider">
<span>New to Akiyama?</span>
</div>
<a href="/auth/signup" class="btn btn-secondary">Create an account</a>
<div class="auth-footer">
By signing in, you agree to our <a href="/terms">Terms of Service</a> and <a href="/privacy">Privacy Policy</a>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer>
<div class="container">
<div class="footer-content">
<p>&copy; 2025 Akiyama Manga. All rights reserved.</p>
<ul class="footer-links">
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
<li><a href="/privacy">Privacy Policy</a></li>
<li><a href="/terms">Terms of Service</a></li>
<li><a href="/upload">Upload Manga</a></li>
</ul>
</div>
</div>
</footer>
<script>
const form = document.getElementById('signInForm');
const errorMessage = document.getElementById('errorMessage');
const successMessage = document.getElementById('successMessage');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
const remember = document.getElementById('remember').checked;
// Clear messages
errorMessage.classList.remove('show');
successMessage.classList.remove('show');
// Show loading state
const btn = form.querySelector('button');
const originalText = btn.textContent;
btn.classList.add('loading');
btn.textContent = 'Signing in...';
try {
const response = await fetch('/api/auth/signin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password })
});
const data = await response.json();
if (response.ok && data.token) {
// Store token
localStorage.setItem('authToken', data.token);
if (remember) {
localStorage.setItem('rememberMe', 'true');
}
// Show success message
successMessage.textContent = 'Sign in successful! Redirecting...';
successMessage.classList.add('show');
// Redirect after a short delay
setTimeout(() => {
window.location.href = '/library';
}, 1500);
} else {
throw new Error(data.message || 'Sign in failed');
}
} catch (error) {
errorMessage.textContent = error.message || 'An error occurred. Please try again.';
errorMessage.classList.add('show');
} finally {
btn.classList.remove('loading');
btn.textContent = originalText;
}
});
// Pre-fill email if "Remember me" was checked
window.addEventListener('load', () => {
if (localStorage.getItem('rememberMe')) {
const savedEmail = localStorage.getItem('savedEmail');
if (savedEmail) {
document.getElementById('email').value = savedEmail;
document.getElementById('remember').checked = true;
}
}
});
</script>
</body>
</html>