Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Reset Password - Law Bot</title> | |
| <link rel="stylesheet" href="/static/css/styles.css"> | |
| <style> | |
| .auth-container { | |
| max-width: 400px; | |
| margin: 50px auto; | |
| padding: 2rem; | |
| background: rgba(255, 255, 255, 0.1); | |
| backdrop-filter: blur(10px); | |
| border-radius: 12px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| color: white; | |
| } | |
| .auth-container h2 { | |
| text-align: center; | |
| margin-bottom: 1.5rem; | |
| } | |
| .form-group { | |
| margin-bottom: 1rem; | |
| } | |
| .form-group label { | |
| display: block; | |
| margin-bottom: 0.5rem; | |
| } | |
| .form-group input { | |
| width: 100%; | |
| padding: 0.75rem; | |
| border: 1px solid rgba(255, 255, 255, 0.2); | |
| border-radius: 6px; | |
| background: rgba(0, 0, 0, 0.2); | |
| color: white; | |
| } | |
| .btn { | |
| width: 100%; | |
| padding: 0.75rem; | |
| background: #9b87f5; | |
| color: white; | |
| border: none; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| font-size: 1rem; | |
| transition: background 0.3s; | |
| } | |
| .btn:hover { | |
| background: #7e69d6; | |
| } | |
| .links { | |
| margin-top: 1rem; | |
| text-align: center; | |
| font-size: 0.9rem; | |
| } | |
| .links a { | |
| color: #D6BCFA; | |
| text-decoration: none; | |
| } | |
| .links a:hover { | |
| text-decoration: underline; | |
| } | |
| </style> | |
| </head> | |
| <body class="dark"> | |
| <div class="auth-container"> | |
| <h2>Reset Password</h2> | |
| <form id="resetPasswordForm"> | |
| <div class="form-group"> | |
| <label for="newPassword">New Password</label> | |
| <input type="password" id="newPassword" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="confirmPassword">Confirm Password</label> | |
| <input type="password" id="confirmPassword" required> | |
| </div> | |
| <button type="submit" class="btn">Reset Password</button> | |
| </form> | |
| <div class="links"> | |
| <a href="/login">Back to Login</a> | |
| </div> | |
| </div> | |
| <script> | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const token = urlParams.get('token'); | |
| if (!token) { | |
| alert('Invalid reset link'); | |
| window.location.href = '/login'; | |
| } | |
| document.getElementById('resetPasswordForm').addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| const newPassword = document.getElementById('newPassword').value; | |
| const confirmPassword = document.getElementById('confirmPassword').value; | |
| if (newPassword !== confirmPassword) { | |
| alert('Passwords do not match'); | |
| return; | |
| } | |
| try { | |
| const response = await fetch('/api/reset-password', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ token, new_password: newPassword }) | |
| }); | |
| const data = await response.json(); | |
| if (response.ok) { | |
| alert('Password reset successful! Please login with your new password.'); | |
| window.location.href = '/login'; | |
| } else { | |
| alert(data.detail || 'Password reset failed'); | |
| } | |
| } catch (error) { | |
| console.error('Error:', error); | |
| alert('An error occurred'); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |