forked from ankit071105/Ticket-Booking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgot_password.html
80 lines (75 loc) · 4.33 KB
/
forgot_password.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Forgot Password</title>
<link rel="shortcut icon" href="https://ticket-booking-blue.vercel.app/images/4.jpeg" type="image/x-icon">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-white">
<div class="relative flex items-top justify-center min-h-screen bg-white sm:items-center sm:pt-0">
<div class="w-5/6 mx-auto sm:px-6 lg:px-8">
<div class="mt-8 overflow-hidden">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="hidden lg:block p-6 mr-2 bg-gray-100 sm:rounded-lg">
<!-- Go back button -->
<a href="login.html" class="flex items-center text-orange-700 hover:underline text-sm mb-4">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 mr-1">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg>
Go back
</a>
<!-- Forgot Password text -->
<h1 class="text-4xl text-gray-800 font-extrabold tracking-tight md:text-3xl">
Forgot Password
</h1>
<br /><br />
<p class="text-normal text-lg sm:text-xl font-medium text-gray-600 mt-2">
Enter your email to receive a new password.
</p>
</div>
<div class="p-6 flex flex-col justify-center">
<!-- Home button positioned above the email input -->
<button onclick="window.location.href='/index.html'" class="self-end text-xs bg-orange-700 hover:bg-orange-600 text-white font-bold py-1 px-2 rounded-lg transition ease-in-out duration-300 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 mr-1">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l9-9m0 0l9 9m-9-9v18" />
</svg>
Home
</button>
<form id="forgotPasswordForm" class="mt-2">
<label for="email" class="mt-4">Email Address:</label>
<input type="email" id="email" name="email" placeholder="Email" required class="w-full mt-2 py-3 px-3 rounded-lg bg-white border border-gray-400 text-gray-800 font-semibold focus:border-orange-500 focus:outline-none">
<button type="submit" class="md:w-32 bg-orange-700 hover:bg-orange-600 text-white font-bold py-3 px-6 rounded-lg mt-3 transition ease-in-out duration-300">Send Code</button>
<p id="message" class="text-red-500 mt-2"></p>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
document.getElementById('forgotPasswordForm').addEventListener('submit', async function(event) {
event.preventDefault();
const email = document.getElementById('email').value;
try {
const response = await fetch('http://localhost:7865/api/v1/auth/forgot-password', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ email })
});
const data = await response.json();
if (response.ok) {
document.getElementById('message').textContent = 'A code has been sent to your email.';
} else {
document.getElementById('message').textContent = data.message || 'Error sending code.';
}
} catch (error) {
document.getElementById('message').textContent = 'An error occurred. Please try again.';
}
});
</script>
</body>
</html>