-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_password.php
97 lines (88 loc) · 2.99 KB
/
forgot_password.php
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!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>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
body {
background-image: url('./img/bg.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
display: flex;
align-items: center;
justify-content: center;
}
.forgot-password-box {
width: 300px;
padding: 20px;
background: rgba(255, 255, 255, 0.7);
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
.forgot-password-box h2 {
text-align: center;
color: #333;
}
.forgot-password-box input[type="email"],
.forgot-password-box button {
width: 100%;
padding: 10px;
margin: 10px 0;
border: none;
border-radius: 5px;
box-sizing: border-box;
}
.forgot-password-box button {
background-color: #007bff;
color: #fff;
cursor: pointer;
}
.forgot-password-box button:hover {
background-color: #0056b3;
}
#forgotPasswordMessage {
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="forgot-password-box">
<h2>Forgot Password</h2>
<div id="forgotPasswordMessage"></div>
<form id="forgotPasswordForm">
<label for="email">Enter your email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<button type="button" onclick="sendResetLink()">Send Reset Link</button>
</form>
<p>Remembered your password? <a href="index.php">Login here</a>.</p>
</div>
<script>
function sendResetLink() {
var form = document.getElementById("forgotPasswordForm");
var message = document.getElementById("forgotPasswordMessage");
var xhr = new XMLHttpRequest();
xhr.open("POST", "./api/send_reset_link.php", true); // Update the URL according to your server endpoint
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
message.textContent = xhr.responseText;
} else {
message.textContent = "Error: " + xhr.status;
}
}
};
xhr.send(new URLSearchParams(new FormData(form)));
}
</script>
</body>
</html>