// Add this HTML to your login page
// Add this JavaScript to handle the login document.getElementById('loginForm').addEventListener('submit', async (event) => { event.preventDefault(); const loginButton = document.getElementById('loginButton'); const errorDiv = document.getElementById('loginError'); // Disable button and show loading state loginButton.disabled = true; loginButton.textContent = 'Logging in...'; errorDiv.style.display = 'none'; // Get form values const email = document.getElementById('email').value; const password = document.getElementById('password').value; try { const { data } = await memberstack.loginMemberEmailPassword({ email, password }); // If login is successful, redirect to dashboard window.location.href = "/dashboard"; } catch (error) { errorDiv.textContent = error.message || "Login failed. Please check your credentials."; errorDiv.style.display = 'block'; } finally { // Reset button state loginButton.disabled = false; loginButton.textContent = 'Log In'; } }); My Super Brain | Interactive ADHD Planner & Routine App for Kids
Scroll to Top