document.addEventListener('DOMContentLoaded', function() { // Check for error parameters in URL const urlParams = new URLSearchParams(window.location.search); const errorParam = urlParams.get('error'); if (errorParam === 'invalid') { // Create error message element const errorDiv = document.createElement('div'); errorDiv.className = 'login-error'; errorDiv.innerHTML = ' Invalid username or password'; // Insert error message above the form const loginForm = document.querySelector('.login-form'); loginForm.parentNode.insertBefore(errorDiv, loginForm); // Style the error message errorDiv.style.backgroundColor = 'rgba(220, 53, 69, 0.1)'; errorDiv.style.color = '#dc3545'; errorDiv.style.padding = '10px'; errorDiv.style.borderRadius = '4px'; errorDiv.style.marginBottom = '20px'; errorDiv.style.fontSize = '14px'; errorDiv.style.textAlign = 'center'; } else if (errorParam === 'session') { // Create session expired message const errorDiv = document.createElement('div'); errorDiv.className = 'login-error'; errorDiv.innerHTML = ' Your session has expired. Please log in again.'; // Insert error message above the form const loginForm = document.querySelector('.login-form