-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathforgot-password.html
More file actions
200 lines (171 loc) · 5.53 KB
/
forgot-password.html
File metadata and controls
200 lines (171 loc) · 5.53 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Forgot Password - AnimateItNow</title>
<link rel="icon" href="favicon.png" type="image/x-icon" />
<style>
body {
font-family: Arial, sans-serif;
background: #f3f4f6;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.form-container {
background: #ffffff;
padding: 2rem 3rem;
border-radius: 0.75rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 300px;
}
h1 {
text-align: center;
margin-bottom: 0.5rem;
color: #111827;
}
.subtitle {
text-align: center;
font-size: 0.95rem;
color: #6b7280;
margin-bottom: 1.5rem;
}
.input-group {
margin-bottom: 1.2rem;
position: relative;
}
label {
display: block;
margin-bottom: 0.4rem;
font-weight: 600;
color: #374151;
font-size: 0.9rem;
}
input {
width: 100%;
padding: 0.75rem 2.5rem 0.75rem 0.75rem;
border-radius: 0.375rem;
border: 1px solid #d1d5db;
font-size: 1rem;
box-sizing: border-box;
}
input:focus {
outline: 2px solid #4f46e5;
outline-offset: 2px;
border-color: #4f46e5;
}
.toggle-password {
position: absolute;
right: 10px;
top: 34px;
cursor: pointer;
color: #6b7280;
font-size: 0.9rem;
user-select: none;
}
.btn {
width: 100%;
padding: 0.75rem;
background: linear-gradient(to right, #3b82f6, #1d4ed8);
color: white;
font-size: 1rem;
border: none;
border-radius: 0.375rem;
cursor: pointer;
font-weight: 600;
}
.btn:hover {
background: linear-gradient(to right, #2563eb, #1e40af);
}
.error-message {
color: #dc2626;
font-size: 0.875rem;
margin-top: 0.25rem;
display: none;
}
.switch {
text-align: center;
margin-top: 1rem;
font-size: 0.9rem;
color: #6b7280;
}
.switch a {
color: #4f46e5;
text-decoration: none;
}
.switch a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<main class="form-container">
<h1>Forgot Password</h1>
<p class="subtitle">Reset your password to continue.</p>
<form id="forgotForm">
<div class="input-group">
<label for="email">Email Address</label>
<input type="email" id="email" placeholder="Enter your email" required>
<div id="emailError" class="error-message"></div>
</div>
<div class="input-group">
<label for="newPassword">New Password</label>
<input type="password" id="newPassword" placeholder="Enter new password" required>
<span class="toggle-password" id="toggleNewPassword">Show</span>
<div id="newPasswordError" class="error-message"></div>
</div>
<div class="input-group">
<label for="confirmPassword">Confirm Password</label>
<input type="password" id="confirmPassword" placeholder="Confirm new password" required>
<span class="toggle-password" id="toggleConfirmPassword">Show</span>
<div id="confirmPasswordError" class="error-message"></div>
</div>
<button type="submit" class="btn">Submit</button>
</form>
<p class="switch">Remember your password? <a href="loginpage.html">Sign in</a></p>
</main>
<script>
const toggleNewPassword = document.getElementById('toggleNewPassword');
const newPasswordInput = document.getElementById('newPassword');
const toggleConfirmPassword = document.getElementById('toggleConfirmPassword');
const confirmPasswordInput = document.getElementById('confirmPassword');
toggleNewPassword.addEventListener('click', () => {
const type = newPasswordInput.getAttribute('type') === 'password' ? 'text' : 'password';
newPasswordInput.setAttribute('type', type);
toggleNewPassword.textContent = type === 'password' ? 'Show' : 'Hide';
});
toggleConfirmPassword.addEventListener('click', () => {
const type = confirmPasswordInput.getAttribute('type') === 'password' ? 'text' : 'password';
confirmPasswordInput.setAttribute('type', type);
toggleConfirmPassword.textContent = type === 'password' ? 'Show' : 'Hide';
});
const form = document.getElementById('forgotForm');
form.addEventListener('submit', function(event) {
event.preventDefault();
document.querySelectorAll('.error-message').forEach(el => el.style.display = 'none');
const email = document.getElementById('email').value.trim();
const newPassword = newPasswordInput.value.trim();
const confirmPassword = confirmPasswordInput.value.trim();
let isValid = true;
if (newPassword.length < 6) {
document.getElementById('newPasswordError').textContent = 'Password cannot be less than 6 characters';
document.getElementById('newPasswordError').style.display = 'block';
isValid = false;
}
if (newPassword !== confirmPassword) {
document.getElementById('confirmPasswordError').textContent = 'Confirm password is not same';
document.getElementById('confirmPasswordError').style.display = 'block';
isValid = false;
}
if (isValid) {
alert('Password reset successful! Redirecting to login page...');
window.location.href = 'loginpage.html';
}
});
</script>
</body>
</html>