mirror of
https://github.com/sassanix/Warracker.git
synced 2025-12-31 18:49:39 -06:00
300 lines
12 KiB
HTML
300 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title data-i18n="auth.reset_password_title">Warracker - Reset Password</title>
|
|
<!-- Favicons -->
|
|
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png?v=2">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png">
|
|
<link rel="manifest" href="manifest.json">
|
|
<link rel="stylesheet" href="style.css?v=20250119004">
|
|
<script src="theme-loader.js?v=20250119001"></script> <!-- Apply theme early -->
|
|
<!-- Font Awesome for icons -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
|
|
<!-- Load header fix styles to ensure consistent header styling -->
|
|
<link rel="stylesheet" href="header-fix.css?v=20250119001">
|
|
<!-- Mobile Header specific styles -->
|
|
<link rel="stylesheet" href="mobile-header.css?v=20250119002">
|
|
<!-- i18next Local Scripts -->
|
|
<script src="js/lib/i18next.min.js?v=20250119001"></script>
|
|
<script src="js/lib/i18nextHttpBackend.min.js?v=20250119001"></script>
|
|
<script src="js/lib/i18nextBrowserLanguageDetector.min.js?v=20250119001"></script>
|
|
<!-- i18n initialization script -->
|
|
<script src="js/i18n.js?v=20250119001"></script>
|
|
<!-- Load fix for auth buttons -->
|
|
<script src="fix-auth-buttons-loader.js?v=20250119001"></script>
|
|
<script src="script.js?v=20250119001" defer></script>
|
|
<style>
|
|
.auth-container {
|
|
max-width: 400px;
|
|
margin: 50px auto;
|
|
padding: 30px;
|
|
background-color: var(--card-bg);
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.auth-title {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.auth-form .form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.auth-links {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.auth-links a {
|
|
color: var(--primary-color);
|
|
text-decoration: none;
|
|
margin: 0 10px;
|
|
}
|
|
|
|
.auth-links a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.auth-message {
|
|
margin-top: 20px;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
text-align: center;
|
|
display: none;
|
|
}
|
|
|
|
.auth-message.error {
|
|
background-color: rgba(244, 67, 54, 0.1);
|
|
color: #f44336;
|
|
border: 1px solid rgba(244, 67, 54, 0.3);
|
|
}
|
|
|
|
.auth-message.success {
|
|
background-color: rgba(76, 175, 80, 0.1);
|
|
color: #4caf50;
|
|
border: 1px solid rgba(76, 175, 80, 0.3);
|
|
}
|
|
|
|
.btn-block {
|
|
width: 100%;
|
|
}
|
|
|
|
.auth-info {
|
|
margin-bottom: 20px;
|
|
color: var(--text-muted);
|
|
text-align: center;
|
|
font-size: 0.9em;
|
|
line-height: 1.5;
|
|
}
|
|
</style>
|
|
|
|
<!-- Registration status check script -->
|
|
<script src="registration-status.js?v=20250119001"></script>
|
|
</head>
|
|
<body>
|
|
<!-- Header -->
|
|
<header>
|
|
<div class="container">
|
|
<div class="app-title">
|
|
<i class="fas fa-shield-alt"></i>
|
|
<h1><a href="index.html" style="color: inherit; text-decoration: none; cursor: pointer;">Warracker</a></h1>
|
|
</div>
|
|
<div class="header-right-group">
|
|
<button class="mobile-menu-toggle" aria-label="Toggle menu"><i class="fas fa-bars"></i></button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="mobile-menu-panel" id="mobileMenuPanel"></div>
|
|
<div class="mobile-menu-overlay" id="mobileMenuOverlay"></div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="container">
|
|
<div class="auth-container">
|
|
<h2 class="auth-title" data-i18n="auth.reset_your_password">Reset Your Password</h2>
|
|
|
|
<p class="auth-info" data-i18n="auth.reset_password_info">
|
|
Enter your email address below and we'll send you a link to reset your password.
|
|
</p>
|
|
|
|
<div id="authMessage" class="auth-message"></div>
|
|
|
|
<form id="resetRequestForm" class="auth-form">
|
|
<div class="form-group">
|
|
<label for="email" data-i18n="auth.email_address">Email Address</label>
|
|
<input type="email" id="email" name="email" class="form-control" data-i18n-placeholder="auth.email_address" placeholder="Email Address" required>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary btn-block">
|
|
<i class="fas fa-paper-plane"></i> <span data-i18n="auth.send_reset_link">Send Reset Link</span>
|
|
</button>
|
|
</form>
|
|
|
|
<div class="auth-links">
|
|
<a href="login.html" data-i18n="auth.back_to_login">Back to Login</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Check if user is already logged in
|
|
const token = localStorage.getItem('auth_token');
|
|
if (token) {
|
|
// Redirect to home page if already logged in
|
|
window.location.href = 'index.html';
|
|
return;
|
|
}
|
|
|
|
// Handle form submission
|
|
const resetRequestForm = document.getElementById('resetRequestForm');
|
|
const authMessage = document.getElementById('authMessage');
|
|
|
|
resetRequestForm.addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
|
|
const email = document.getElementById('email').value;
|
|
|
|
// Basic validation
|
|
if (!email) {
|
|
showMessage('Please enter your email address', 'error');
|
|
return;
|
|
}
|
|
|
|
// Validate email format
|
|
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
if (!emailRegex.test(email)) {
|
|
showMessage('Please enter a valid email address', 'error');
|
|
return;
|
|
}
|
|
|
|
// Get the submit button element
|
|
const submitBtn = resetRequestForm.querySelector('button[type="submit"]');
|
|
let originalBtnText = ''; // Initialize outside
|
|
|
|
if (!submitBtn) {
|
|
console.error('Submit button not found');
|
|
showMessage('An unexpected error occurred. Please try again.', 'error');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
// Show loading state
|
|
originalBtnText = submitBtn.innerHTML; // Assign original text here
|
|
submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Sending Request...';
|
|
submitBtn.disabled = true;
|
|
|
|
// Make API request
|
|
const response = await fetch('/api/auth/password/reset-request', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
email
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (!response.ok) {
|
|
throw new Error(data.message || 'Password reset request failed');
|
|
}
|
|
|
|
// Show success message
|
|
showMessage('Password reset instructions have been sent to your email. Please check your inbox.', 'success');
|
|
|
|
// Clear form
|
|
resetRequestForm.reset();
|
|
|
|
} catch (error) {
|
|
console.error('Password reset request error:', error);
|
|
showMessage(error.message || 'Password reset request failed. Please try again.', 'error');
|
|
} finally {
|
|
// Reset button only if it exists
|
|
if (submitBtn) {
|
|
submitBtn.innerHTML = originalBtnText;
|
|
submitBtn.disabled = false;
|
|
}
|
|
}
|
|
});
|
|
|
|
function showMessage(message, type) {
|
|
authMessage.textContent = message;
|
|
authMessage.className = 'auth-message';
|
|
authMessage.classList.add(type);
|
|
authMessage.style.display = 'block';
|
|
}
|
|
|
|
// No longer check for 'enabled' value. Theme is handled by theme-loader.js and below.
|
|
});
|
|
|
|
// Theme initialization
|
|
function setTheme(isDark) {
|
|
document.documentElement.setAttribute('data-theme', isDark ? 'dark' : 'light');
|
|
}
|
|
|
|
function initializeTheme() {
|
|
// Check for saved theme preference
|
|
const savedTheme = localStorage.getItem('darkMode');
|
|
|
|
if (savedTheme !== null) {
|
|
// Use saved preference
|
|
setTheme(savedTheme === 'true');
|
|
} else {
|
|
// Use system preference as fallback
|
|
const prefersDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
setTheme(prefersDarkMode);
|
|
}
|
|
}
|
|
|
|
// Initialize theme when page loads
|
|
document.addEventListener('DOMContentLoaded', initializeTheme);
|
|
</script>
|
|
|
|
<script src="auth.js?v=20250119001"></script>
|
|
|
|
<!-- Footer Width Fix -->
|
|
<script src="footer-fix.js?v=20251024001"></script>
|
|
|
|
<!-- Footer Content Manager -->
|
|
<script src="footer-content.js?v=20250119001"></script>
|
|
|
|
<!-- Powered by Warracker Footer -->
|
|
<footer class="warracker-footer" id="warrackerFooter">
|
|
<!-- Content will be dynamically generated by footer-content.js -->
|
|
</footer>
|
|
|
|
<script>
|
|
function applyFooterStyles() {
|
|
const footer = document.getElementById('warrackerFooter');
|
|
const link = document.getElementById('warrackerFooterLink');
|
|
const isDarkMode = document.documentElement.getAttribute('data-theme') === 'dark' || document.documentElement.classList.contains('dark-mode') || document.body.classList.contains('dark-mode');
|
|
if (footer) {
|
|
if (isDarkMode) {
|
|
// Dark mode styles - using same background as header (#2d2d2d)
|
|
footer.style.cssText = 'margin-top: 50px; padding: 20px; text-align: center; border-top: 1px solid #444; background-color: #2d2d2d; color: #e0e0e0; font-size: 0.9rem;';
|
|
if (link) link.style.cssText = 'color: #4dabf7; text-decoration: none; font-weight: 500;';
|
|
} else {
|
|
// Light mode styles - using same background as header (#ffffff)
|
|
footer.style.cssText = 'margin-top: 50px; padding: 20px; text-align: center; border-top: 1px solid #e0e0e0; background-color: #ffffff; color: #333333; font-size: 0.9rem;';
|
|
if (link) link.style.cssText = 'color: #3498db; text-decoration: none; font-weight: 500;';
|
|
}
|
|
}
|
|
}
|
|
document.addEventListener('DOMContentLoaded', applyFooterStyles);
|
|
const obs = new MutationObserver(applyFooterStyles);
|
|
obs.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'class'] });
|
|
obs.observe(document.body, { attributes: true, attributeFilter: ['class'] });
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|