datavault-pro / script.js
raibaebe's picture
receent updetaes will be based on real excel dta not text
e0cbd77 verified
Raw History Blame Contribute Delete
1.45 kB
// API base URL
const API_BASE_URL = 'https://jsonplaceholder.typicode.com';
// Handle login form submission
document.addEventListener('DOMContentLoaded', function() {
const loginForm = document.querySelector('form');
if (loginForm) {
loginForm.addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
// Simple admin check (in real app, use proper authentication)
if (username === 'admin' && password === 'admin123') {
window.location.href = '/admin.html';
} else {
showLoginError('Invalid credentials. Admin login: admin/admin123');
}
});
}
// Check for error messages in URL (simulated)
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('error')) {
showLoginError(urlParams.get('error'));
}
});
function showLoginError(message) {
const errorDiv = document.createElement('div');
errorDiv.className = 'error-message';
errorDiv.innerHTML = `
<i data-feather="alert-circle"></i>
${message || 'Invalid username or password. Please try again.'}
`;
const form = document.querySelector('form');
if (form) {
form.prepend(errorDiv);
feather.replace();
}
}