Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Reset Password</title> | |
| <link rel="icon" type="image/png" href="{{ url_for('static', filename='logo.png') }}"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"> | |
| <style> | |
| /* General Styles */ | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| font-family: 'Arial', sans-serif; | |
| } | |
| body { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| background: url("{{ url_for('static', filename='pic7.jpg') }}") no-repeat center center/cover; | |
| color: white; | |
| } | |
| .login-container { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| width: 100%; | |
| } | |
| .login-card { | |
| background: black; | |
| padding: 30px; | |
| border-radius: 12px; | |
| box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.1); | |
| text-align: center; | |
| width: 360px; | |
| } | |
| .logo img { | |
| width: 150px; | |
| } | |
| form { | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| label { | |
| text-align: left; | |
| font-size: 14px; | |
| margin: 9px 0; | |
| } | |
| input { | |
| padding: 10px; | |
| margin-bottom: 10px; | |
| border: 1px solid #ccc; | |
| border-radius: 5px; | |
| width: 100%; | |
| } | |
| .password-container { | |
| position: relative; | |
| } | |
| .toggle-password { | |
| position: absolute; | |
| right: 10px; | |
| top: 50%; | |
| transform: translateY(-50%); | |
| cursor: pointer; | |
| color: #d4a373; | |
| } | |
| .sign-in-btn { | |
| background-color: #d4a373; | |
| color: white; | |
| padding: 10px; | |
| border: none; | |
| border-radius: 5px; | |
| cursor: pointer; | |
| transition: 0.3s; | |
| } | |
| .sign-in-btn:hover { | |
| background-color: black; | |
| border: 1px solid #d4a373; | |
| } | |
| @media (max-width: 480px) { | |
| .login-card { | |
| padding: 20px; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="login-container"> | |
| <div class="login-card"> | |
| <div class="logo"> | |
| <img src="{{ url_for('static', filename='logo.png') }}" alt="Lawsumm logo"> | |
| </div> | |
| <h2>LawSumm</h2> | |
| <h2>Reset Password</h2> | |
| <form id="resetPasswordForm" method="POST"> | |
| <label for="email">Email</label> | |
| <input type="email" id="email" placeholder="Enter your email" required> | |
| <label for="newPassword">New Password</label> | |
| <div class="password-container"> | |
| <input type="password" id="newPassword" name="newPassword" placeholder="Enter your new password" | |
| required> | |
| <span class="toggle-password" onclick="togglePassword('newPassword', this)"> | |
| <i class="fa-solid fa-eye"></i> | |
| </span> | |
| </div> | |
| <label for="confirmPassword">Confirm New Password</label> | |
| <div class="password-container"> | |
| <input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm your new password" | |
| onpaste="return false;" required> | |
| <span class="toggle-password" onclick="togglePassword('confirmPassword', this)"> | |
| <i class="fa-solid fa-eye"></i> | |
| </span> | |
| </div> | |
| <button type="submit" class="sign-in-btn">Reset Password</button> | |
| </form> | |
| </div> | |
| </div> | |
| <script> | |
| // Toggle Password Visibility | |
| function togglePassword(fieldId, iconElement) { | |
| const passwordInput = document.getElementById(fieldId); | |
| const icon = iconElement.querySelector("i"); | |
| if (passwordInput.type === "password") { | |
| passwordInput.type = "text"; | |
| icon.classList.remove("fa-eye"); | |
| icon.classList.add("fa-eye-slash"); | |
| } else { | |
| passwordInput.type = "password"; | |
| icon.classList.remove("fa-eye-slash"); | |
| icon.classList.add("fa-eye"); | |
| } | |
| } | |
| // Handle Form Submission | |
| // Handle Password Reset | |
| document.getElementById('resetPasswordForm').addEventListener('submit', async function(e) { | |
| e.preventDefault(); | |
| const email = document.getElementById('email').value.trim(); | |
| const newPassword = document.getElementById('newPassword').value.trim(); | |
| const confirmPassword = document.getElementById('confirmPassword').value.trim(); | |
| // Check if all fields are filled | |
| if (!email || !newPassword || !confirmPassword) { | |
| showError("Please fill in all fields."); | |
| return; | |
| } | |
| // Check if passwords match | |
| if (newPassword !== confirmPassword) { | |
| showError("Passwords do not match!"); | |
| return; | |
| } | |
| // Prepare form data | |
| const formData = new FormData(); | |
| formData.append('email', email); | |
| formData.append('newPassword', newPassword); | |
| formData.append('confirmPassword', confirmPassword); | |
| try { | |
| const response = await fetch('https://izza-shahzad-13-laww.hf.space/reset-password', { | |
| method: 'POST', | |
| body: formData | |
| }); | |
| const result = await response.json(); | |
| alert(result.message); | |
| if (response.ok) { | |
| window.location.href = "{{ url_for('login') }}"; | |
| } | |
| } catch (err) { | |
| showError("Something went wrong. Please try again."); | |
| console.error(err); | |
| } | |
| }); | |
| function showError(message) { | |
| alert(message); // Replace this with a better UI error handler if needed | |
| } | |
| </script> | |
| </body> | |
| </html> | |