Spaces:
Running
Running
Update src/apps/templates/forgot_password.html
Browse files- src/apps/templates/forgot_password.html +124 -118
src/apps/templates/forgot_password.html
CHANGED
|
@@ -1,119 +1,125 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>Forgot Password - Law Bot</title>
|
| 8 |
-
<link rel="stylesheet" href="/static/css/styles.css">
|
| 9 |
-
<style>
|
| 10 |
-
/* Reuse styles */
|
| 11 |
-
.auth-container {
|
| 12 |
-
max-width: 400px;
|
| 13 |
-
margin: 50px auto;
|
| 14 |
-
padding: 2rem;
|
| 15 |
-
background: rgba(255, 255, 255, 0.1);
|
| 16 |
-
backdrop-filter: blur(10px);
|
| 17 |
-
border-radius: 12px;
|
| 18 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 19 |
-
color: white;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
.auth-container h2 {
|
| 23 |
-
text-align: center;
|
| 24 |
-
margin-bottom: 1.5rem;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
.form-group {
|
| 28 |
-
margin-bottom: 1rem;
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
.form-group label {
|
| 32 |
-
display: block;
|
| 33 |
-
margin-bottom: 0.5rem;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
.form-group input {
|
| 37 |
-
width: 100%;
|
| 38 |
-
padding: 0.75rem;
|
| 39 |
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 40 |
-
border-radius: 6px;
|
| 41 |
-
background: rgba(0, 0, 0, 0.2);
|
| 42 |
-
color: white;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
.btn {
|
| 46 |
-
width: 100%;
|
| 47 |
-
padding: 0.75rem;
|
| 48 |
-
background: #9b87f5;
|
| 49 |
-
color: white;
|
| 50 |
-
border: none;
|
| 51 |
-
border-radius: 6px;
|
| 52 |
-
cursor: pointer;
|
| 53 |
-
font-size: 1rem;
|
| 54 |
-
transition: background 0.3s;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.btn:hover {
|
| 58 |
-
background: #7e69d6;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
.links {
|
| 62 |
-
margin-top: 1rem;
|
| 63 |
-
text-align: center;
|
| 64 |
-
font-size: 0.9rem;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
.links a {
|
| 68 |
-
color: #D6BCFA;
|
| 69 |
-
text-decoration: none;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
.links a:hover {
|
| 73 |
-
text-decoration: underline;
|
| 74 |
-
}
|
| 75 |
-
</style>
|
| 76 |
-
</head>
|
| 77 |
-
|
| 78 |
-
<body class="dark">
|
| 79 |
-
<div class="auth-container">
|
| 80 |
-
<h2>Forgot Password</h2>
|
| 81 |
-
<form id="forgotPasswordForm">
|
| 82 |
-
<div class="form-group">
|
| 83 |
-
<label for="email">Email</label>
|
| 84 |
-
<input type="email" id="email" required>
|
| 85 |
-
</div>
|
| 86 |
-
<button type="submit" class="btn">Send Reset Link</button>
|
| 87 |
-
</form>
|
| 88 |
-
<div class="links">
|
| 89 |
-
<a href="/login">Back to Login</a>
|
| 90 |
-
</div>
|
| 91 |
-
</div>
|
| 92 |
-
|
| 93 |
-
<script>
|
| 94 |
-
document.getElementById('forgotPasswordForm').addEventListener('submit', async (e) => {
|
| 95 |
-
e.preventDefault();
|
| 96 |
-
const email = document.getElementById('email').value;
|
| 97 |
-
|
| 98 |
-
try {
|
| 99 |
-
const response = await fetch('/api/forgot-password', {
|
| 100 |
-
method: 'POST',
|
| 101 |
-
headers: { 'Content-Type': 'application/json' },
|
| 102 |
-
body: JSON.stringify({ email })
|
| 103 |
-
});
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Forgot Password - Law Bot</title>
|
| 8 |
+
<link rel="stylesheet" href="/static/css/styles.css">
|
| 9 |
+
<style>
|
| 10 |
+
/* Reuse styles */
|
| 11 |
+
.auth-container {
|
| 12 |
+
max-width: 400px;
|
| 13 |
+
margin: 50px auto;
|
| 14 |
+
padding: 2rem;
|
| 15 |
+
background: rgba(255, 255, 255, 0.1);
|
| 16 |
+
backdrop-filter: blur(10px);
|
| 17 |
+
border-radius: 12px;
|
| 18 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 19 |
+
color: white;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.auth-container h2 {
|
| 23 |
+
text-align: center;
|
| 24 |
+
margin-bottom: 1.5rem;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.form-group {
|
| 28 |
+
margin-bottom: 1rem;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.form-group label {
|
| 32 |
+
display: block;
|
| 33 |
+
margin-bottom: 0.5rem;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.form-group input {
|
| 37 |
+
width: 100%;
|
| 38 |
+
padding: 0.75rem;
|
| 39 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 40 |
+
border-radius: 6px;
|
| 41 |
+
background: rgba(0, 0, 0, 0.2);
|
| 42 |
+
color: white;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.btn {
|
| 46 |
+
width: 100%;
|
| 47 |
+
padding: 0.75rem;
|
| 48 |
+
background: #9b87f5;
|
| 49 |
+
color: white;
|
| 50 |
+
border: none;
|
| 51 |
+
border-radius: 6px;
|
| 52 |
+
cursor: pointer;
|
| 53 |
+
font-size: 1rem;
|
| 54 |
+
transition: background 0.3s;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.btn:hover {
|
| 58 |
+
background: #7e69d6;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.links {
|
| 62 |
+
margin-top: 1rem;
|
| 63 |
+
text-align: center;
|
| 64 |
+
font-size: 0.9rem;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.links a {
|
| 68 |
+
color: #D6BCFA;
|
| 69 |
+
text-decoration: none;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.links a:hover {
|
| 73 |
+
text-decoration: underline;
|
| 74 |
+
}
|
| 75 |
+
</style>
|
| 76 |
+
</head>
|
| 77 |
+
|
| 78 |
+
<body class="dark">
|
| 79 |
+
<div class="auth-container">
|
| 80 |
+
<h2>Forgot Password</h2>
|
| 81 |
+
<form id="forgotPasswordForm">
|
| 82 |
+
<div class="form-group">
|
| 83 |
+
<label for="email">Email</label>
|
| 84 |
+
<input type="email" id="email" required>
|
| 85 |
+
</div>
|
| 86 |
+
<button type="submit" class="btn">Send Reset Link</button>
|
| 87 |
+
</form>
|
| 88 |
+
<div class="links">
|
| 89 |
+
<a href="/login">Back to Login</a>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<script>
|
| 94 |
+
document.getElementById('forgotPasswordForm').addEventListener('submit', async (e) => {
|
| 95 |
+
e.preventDefault();
|
| 96 |
+
const email = document.getElementById('email').value;
|
| 97 |
+
|
| 98 |
+
try {
|
| 99 |
+
const response = await fetch('/api/forgot-password', {
|
| 100 |
+
method: 'POST',
|
| 101 |
+
headers: { 'Content-Type': 'application/json' },
|
| 102 |
+
body: JSON.stringify({ email })
|
| 103 |
+
});
|
| 104 |
+
|
| 105 |
+
if (response.ok) {
|
| 106 |
+
alert('If an account exists with this email, a reset link has been sent.');
|
| 107 |
+
} else {
|
| 108 |
+
let errorMessage = 'Request failed';
|
| 109 |
+
try {
|
| 110 |
+
const data = await response.json();
|
| 111 |
+
errorMessage = data.detail || errorMessage;
|
| 112 |
+
} catch (e) {
|
| 113 |
+
errorMessage = `Server Error (${response.status})`;
|
| 114 |
+
}
|
| 115 |
+
alert(errorMessage);
|
| 116 |
+
}
|
| 117 |
+
} catch (error) {
|
| 118 |
+
console.error('Error:', error);
|
| 119 |
+
alert('An error occurred');
|
| 120 |
+
}
|
| 121 |
+
});
|
| 122 |
+
</script>
|
| 123 |
+
</body>
|
| 124 |
+
|
| 125 |
</html>
|