diff --git a/ngrok.yml b/ngrok.yml deleted file mode 100644 index 85ccd67..0000000 --- a/ngrok.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -authtoken: 2gibp9BBceUJDZtNScqH5ivAUTA_2EVNSsmY6HkNYuY6aw7a4 -tunnels: - myapp: - proto: http - addr: 3000 - hostname: wired-terminally-muskrat.ngrok-free.app - # No bind_tls here! - # Optionally, you can specify 'scheme: https' diff --git a/public/images/logo-colored-vertical.svg b/public/images/logo-colored-vertical.svg new file mode 100644 index 0000000..1a98240 --- /dev/null +++ b/public/images/logo-colored-vertical.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/server.js b/src/server.js index c5f660b..81465f2 100644 --- a/src/server.js +++ b/src/server.js @@ -63,6 +63,9 @@ app.get('/health', (req, res) => { app.get("/client/login", (req, res) => { res.render("client_login") }) +app.get("/client/forgot-password", (req, res) => { + res.render("forgot_password") +}) app.get("/live/:projectId", (req, res) => { const { projectId } = req.params; diff --git a/views/client_login.ejs b/views/client_login.ejs index 1db99a0..a4419ab 100644 --- a/views/client_login.ejs +++ b/views/client_login.ejs @@ -220,10 +220,10 @@

Log in to your account to continue

-
+ - Forgot password? + Forgot password? @@ -247,6 +247,50 @@ } setTheme(getSystemTheme()); + + document.querySelector("form").addEventListener("submit", async (e) => { + e.preventDefault(); // prevent page reload + + const email = e.target.email.value.trim(); + const password = e.target.password.value.trim(); + + if (!email || !password) { + alert("Please enter both email and password"); + return; + } + const userDetails = { + email, + password, + }; + try { + const res = await fetch("/api/v1/client/login", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({"userDetails": userDetails}), + }); + + const data = await res.json(); + + if (!res.ok) { + throw new Error(data.message || "Login failed"); + } + + if (data.token) { + // 🟢 Save token + localStorage.setItem("authToken", data.token); + + // 🟢 Redirect + window.location.href = "/client/dashboard"; + } else { + alert("No token received. Please try again."); + } + } catch (err) { + console.error("❌ Login error:", err); + alert(err.message || "Something went wrong while logging in"); + } + }); diff --git a/views/forgot_password.ejs b/views/forgot_password.ejs new file mode 100644 index 0000000..c9e1ff6 --- /dev/null +++ b/views/forgot_password.ejs @@ -0,0 +1,193 @@ + + + + + + + DocVA | Reset Password + + + + + +
+ + +

Reset your password

+ + + Go back to login + +
+ + + + + \ No newline at end of file