Well
Sourced
β Back to Sign In
π
Account Recovery
Forgot your password?
Enter your email address and we'll send you a link to reset it.
Email address
Send Reset Link β
Remembered your password?
Sign in
async function doForgotPassword() { const email = document.getElementById('email').value.trim(); const errorEl = document.getElementById('form-error'); const successEl = document.getElementById('form-success'); const btn = document.getElementById('submit-btn'); // Clear alerts errorEl.textContent = ''; errorEl.className = 'alert'; successEl.textContent = ''; successEl.className = 'alert'; if (!email) { errorEl.textContent = 'Please enter your email address.'; errorEl.className = 'alert visible alert-error'; return; } const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRe.test(email)) { errorEl.textContent = 'Please enter a valid email address.'; errorEl.className = 'alert visible alert-error'; return; } btn.disabled = true; btn.textContent = 'Sendingβ¦'; try { const r = await fetch('/api/user/forgot-password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email }) }); const d = await r.json(); if (d.success) { // Hide form, show success document.getElementById('form-body').style.display = 'none'; successEl.innerHTML = 'β If that email is registered with WellSourced, a reset link is on its way. Check your inbox β and your spam folder just in case.'; successEl.className = 'alert visible alert-success'; } else { errorEl.textContent = d.error || 'Something went wrong. Please try again.'; errorEl.className = 'alert visible alert-error'; btn.disabled = false; btn.textContent = 'Send Reset Link β'; } } catch { errorEl.textContent = 'Network error. Please try again.'; errorEl.className = 'alert visible alert-error'; btn.disabled = false; btn.textContent = 'Send Reset Link β'; } } // Enter key support document.addEventListener('keydown', (e) => { if (e.key === 'Enter') doForgotPassword(); });