297 lines
8.0 KiB
Plaintext
297 lines
8.0 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en" data-theme="light">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>DocVA | Login</title>
|
|
|
|
<style>
|
|
:root {
|
|
--color-bg-light: #ffffff;
|
|
--color-bg-dark: #121212;
|
|
--color-card-light: #ffffff;
|
|
--color-card-dark: #1e1e1e;
|
|
--color-text-light: #1a1a1a;
|
|
--color-text-dark: #f5f5f5;
|
|
--color-muted-light: #777;
|
|
--color-muted-dark: #aaa;
|
|
--color-primary: #0d0b57;
|
|
--color-secondary: #2b8efc;
|
|
--color-input-light: #f5f5f5;
|
|
--color-input-dark: #2a2a2a;
|
|
--radius: 14px;
|
|
}
|
|
|
|
[data-theme="dark"] {
|
|
--color-bg: var(--color-bg-dark);
|
|
--color-card: var(--color-card-dark);
|
|
--color-text: var(--color-text-dark);
|
|
--color-muted: var(--color-muted-dark);
|
|
--color-input: var(--color-input-dark);
|
|
}
|
|
|
|
[data-theme="light"] {
|
|
--color-bg: var(--color-bg-light);
|
|
--color-card: var(--color-card-light);
|
|
--color-text: var(--color-text-light);
|
|
--color-muted: var(--color-muted-light);
|
|
--color-input: var(--color-input-light);
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
font-family: "Inter", sans-serif;
|
|
background-color: var(--color-bg);
|
|
color: var(--color-text);
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100vh;
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
}
|
|
|
|
.logo {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.logo img {
|
|
width: 170px;
|
|
height: auto;
|
|
}
|
|
|
|
.logo h1 {
|
|
margin: 10px 0 2px 0;
|
|
font-size: 2.3em;
|
|
font-weight: 700;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.logo p {
|
|
color: var(--color-muted);
|
|
font-size: 0.9em;
|
|
letter-spacing: 0.05em;
|
|
}
|
|
|
|
.login-card {
|
|
background-color: var(--color-card);
|
|
border-radius: var(--radius);
|
|
padding: 18px 40px 35px 40px;
|
|
/* width: 30%; */
|
|
/* max-width: 410px; */
|
|
width: 320px;
|
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
text-align: center;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.login-card h2 {
|
|
margin-bottom: 25px;
|
|
color: var(--color-muted);
|
|
font-weight: 500;
|
|
font-size: 0.95em;
|
|
}
|
|
|
|
input {
|
|
width: calc(100% - 28px);
|
|
padding: 12px 14px;
|
|
margin-bottom: 18px;
|
|
border: none;
|
|
border-radius: 10px;
|
|
background-color: var(--color-input);
|
|
color: var(--color-text);
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
input:focus {
|
|
outline: 2px solid var(--color-secondary);
|
|
}
|
|
|
|
.forgot {
|
|
display: block;
|
|
text-align: right;
|
|
font-size: 0.8em;
|
|
color: var(--color-muted);
|
|
text-decoration: none;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.forgot:hover {
|
|
color: var(--color-secondary);
|
|
}
|
|
|
|
.btn {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: none;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
font-weight: 600;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--color-primary);
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background-color: #0a0848;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background-color: transparent;
|
|
border: 1.5px solid #ccc;
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
border-color: var(--color-secondary);
|
|
color: var(--color-secondary);
|
|
}
|
|
|
|
.divider {
|
|
display: flex;
|
|
align-items: center;
|
|
text-align: center;
|
|
color: var(--color-muted);
|
|
margin: 18px 0;
|
|
font-size: 0.85em;
|
|
}
|
|
|
|
.divider::before,
|
|
.divider::after {
|
|
content: "";
|
|
flex: 1;
|
|
border-bottom: 1px solid #ccc;
|
|
}
|
|
|
|
.divider:not(:empty)::before {
|
|
margin-right: 0.75em;
|
|
}
|
|
|
|
.divider:not(:empty)::after {
|
|
margin-left: 0.75em;
|
|
}
|
|
|
|
.theme-toggle {
|
|
position: absolute;
|
|
top: 20px;
|
|
right: 20px;
|
|
cursor: pointer;
|
|
font-size: 0.9em;
|
|
color: var(--color-muted);
|
|
background: none;
|
|
border: none;
|
|
outline: none;
|
|
transition: color 0.2s ease;
|
|
}
|
|
|
|
.theme-toggle:hover {
|
|
color: var(--color-secondary);
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.login-card {
|
|
width: 280px;
|
|
padding: 25px;
|
|
}
|
|
|
|
.logo img {
|
|
width: 100px;
|
|
}
|
|
|
|
.logo h1 {
|
|
font-size: 1.8em;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="logo">
|
|
<img src="/public/images/logo-white-vertical.svg" alt="DocVA Logo" />
|
|
<!-- <h1>DocVA</h1>
|
|
<p>VIRTUAL ASSISTANTS FOR DOCTORS</p> -->
|
|
</div>
|
|
|
|
<div class="login-card">
|
|
<h2>Log in to your account to continue</h2>
|
|
|
|
<form>
|
|
<input type="email" name="email" placeholder="Enter your email address *" required />
|
|
<input type="password" name="password" placeholder="Enter your password *" required />
|
|
<a href="/client/forgot-password" class="forgot">Forgot password?</a>
|
|
|
|
<button type="submit" class="btn btn-primary">🔒 Log in using password</button>
|
|
|
|
<div class="divider">OR</div>
|
|
|
|
<button type="button" class="btn btn-secondary"># Log in with Email Code</button>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
const root = document.documentElement;
|
|
|
|
function setTheme(theme) {
|
|
root.setAttribute("data-theme", theme);
|
|
}
|
|
|
|
function getSystemTheme() {
|
|
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
? "dark"
|
|
: "light";
|
|
}
|
|
|
|
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.success) {
|
|
// 🟢 Save token
|
|
localStorage.setItem("knoptpq", data.accessToken);
|
|
|
|
// 🟢 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");
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |