Fix AI chatbot role mapping, add markdown formatting, update system prompts, and handle OpenRouter API errors
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>BookKeepPro | Reset Password</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="/css/base.css"/>
|
||||
<link rel="stylesheet" href="/css/components.css"/>
|
||||
<link rel="stylesheet" href="/css/animations.css"/>
|
||||
|
||||
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
|
||||
<div class="auth-shell page-enter">
|
||||
|
||||
<div class="auth-brand">
|
||||
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
|
||||
<div class="brand-divider"></div>
|
||||
<h2>Choose a New Password</h2>
|
||||
<p>Pick something strong — at least 8 characters with a mix of letters, numbers, and symbols.</p>
|
||||
</div>
|
||||
|
||||
<div class="auth-form-side">
|
||||
<div class="auth-box">
|
||||
<div style="font-size:40px;margin-bottom:12px;">🔒</div>
|
||||
<h1>Reset Password</h1>
|
||||
<p class="auth-subtitle">Enter your new password below</p>
|
||||
|
||||
<div class="form-group" style="margin-top:24px;">
|
||||
<label class="form-label" for="password">New Password</label>
|
||||
<div class="password-wrap">
|
||||
<input id="password" type="password" class="input" placeholder="At least 8 characters"/>
|
||||
<button type="button" class="password-toggle" onclick="togglePassword()">Show</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary w-full" id="resetBtn" onclick="resetPassword()" style="border-radius:var(--radius-sm);">
|
||||
Reset Password
|
||||
</button>
|
||||
|
||||
<div class="auth-links"><a href="/login" class="fancy-link">Back to Sign In</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/js/toast.js"></script>
|
||||
<script src="/js/password-strength.js"></script>
|
||||
<script>
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const token = params.get("token");
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (!token) showToast("Invalid or missing reset link. Request a new one.", "error", 0);
|
||||
initPasswordStrength("password");
|
||||
});
|
||||
|
||||
async function resetPassword() {
|
||||
const new_password = document.getElementById("password").value;
|
||||
const btn = document.getElementById("resetBtn");
|
||||
if (!new_password) { showToast("Please enter a new password", "warning"); return; }
|
||||
|
||||
btn.disabled = true; btn.textContent = "Resetting…";
|
||||
try {
|
||||
const res = await fetch("/api/auth/reset-password", {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ token, new_password })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) { showToast(data.detail || "Password reset failed", "error"); return; }
|
||||
showToast("Password reset! Redirecting to sign in…", "success");
|
||||
setTimeout(() => window.location.href = "/login", 2000);
|
||||
} catch { showToast("Network error. Please try again.", "error"); }
|
||||
finally { btn.disabled = false; btn.textContent = "Reset Password"; }
|
||||
}
|
||||
|
||||
function togglePassword() {
|
||||
const input = document.getElementById("password");
|
||||
const btn = document.querySelector(".password-toggle");
|
||||
input.type = input.type === "password" ? "text" : "password";
|
||||
btn.textContent = input.type === "password" ? "Show" : "Hide";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user