From ccc3f92d04e53ce7812c76586c03e74f306fb654 Mon Sep 17 00:00:00 2001 From: oliver Date: Mon, 8 Jun 2026 09:37:14 -0300 Subject: [PATCH] password reset --- app.js | 40 +++++++++++++++++++++ index.html | 81 +++++++++++++++++++++++++++++++++++++++++ styles.css | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+) diff --git a/app.js b/app.js index 6fb650f..8d431b6 100644 --- a/app.js +++ b/app.js @@ -34,6 +34,8 @@ const AUTH_URL = "https://n8n.derez.ai/webhook/e256310a-6627-45ba-a221-599751943fe6"; const ACCOUNT_PASSWORD_URL = "https://n8n.derez.ai/webhook/4644f196-a31c-4d1a-b76e-03e9afe39302"; +const PW_RESET_URL = + "https://n8n.derez.ai/webhook/c2ce0eba-eb26-405d-8a90-8d982ec30698"; /* ─── State ─────────────────────────────────────────────────── */ let currentEmail = null; @@ -129,6 +131,8 @@ function switchAuthTab(tab) { document.getElementById("signin-error").style.display = "none"; document.getElementById("signup-error").style.display = "none"; document.getElementById("signup-success").style.display = "none"; + const _rpw = document.getElementById("reset-pw-wrap"); + if (_rpw) _rpw.style.display = "none"; } /* ═══════════════════════════════════════════════════════════════ @@ -182,6 +186,7 @@ async function doSignIn() { loadAgents(); } catch (err) { showAuthError("signin-error", err.message); + showResetOption(); } finally { btnReset(btn); } @@ -1824,6 +1829,41 @@ function showAuthError(id, msg) { function hideAuthError(id) { document.getElementById(id).style.display = "none"; + if (id === "signin-error") { + const wrap = document.getElementById("reset-pw-wrap"); + if (wrap) wrap.style.display = "none"; + } +} + +function showResetOption() { + const wrap = document.getElementById("reset-pw-wrap"); + if (!wrap) return; + // Return to idle state in case it was previously used + document.getElementById("reset-pw-idle").style.display = "flex"; + document.getElementById("reset-pw-sent").style.display = "none"; + wrap.style.display = "block"; +} + +async function sendPasswordReset() { + const email = document.getElementById("signin-email").value.trim(); + if (!email) { + toast("Enter your email address above first.", "warning"); + return; + } + const btn = document.getElementById("reset-pw-btn"); + btnLoad(btn, "Sending…"); + try { + await fetch(PW_RESET_URL, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ email }), + }); + } catch (_) { + // Always show sent — never reveal whether the address exists + } finally { + document.getElementById("reset-pw-idle").style.display = "none"; + document.getElementById("reset-pw-sent").style.display = "flex"; + } } /* ═══════════════════════════════════════════════════════════════ diff --git a/index.html b/index.html index 24a6165..2f300ea 100644 --- a/index.html +++ b/index.html @@ -131,6 +131,87 @@ />
+ + +