forked from Code-Social/official-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
216 lines (184 loc) · 6.52 KB
/
signup.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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Signup Form</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.signup-container {
background-color: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
}
.signup-container h2 {
text-align: center;
color: #4CAF50;
margin-bottom: 20px;
font-size: 24px;
}
.signup-container input {
width: 100%;
padding: 12px;
margin: 10px 0;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 5px;
box-sizing: border-box;
transition: border-color 0.3s ease;
}
.signup-container input:focus {
border-color: #4CAF50;
}
.signup-container button {
width: 100%;
padding: 12px;
background-color: #4CAF50;
color: white;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.signup-container button:hover {
background-color: #45a049;
}
.signup-container .error-message {
color: red;
font-size: 14px;
margin-top: -10px;
margin-bottom: 10px;
}
.signup-container .success-message {
color: green;
font-size: 14px;
margin-top: -10px;
margin-bottom: 10px;
}
.login-link {
text-align: center;
margin-top: 20px;
}
.login-link a {
color: #4CAF50;
text-decoration: none;
font-size: 14px;
}
.login-link a:hover {
text-decoration: underline;
}
/* Responsive */
@media (max-width: 768px) {
.signup-container {
padding: 20px;
}
.signup-container h2 {
font-size: 20px;
}
.signup-container input {
padding: 10px;
}
.signup-container button {
padding: 10px;
font-size: 14px;
}
}
</style>
</head>
<body>
<div class="signup-container">
<h2>Signup</h2>
<form id="signupForm">
<input type="text" id="username" name="username" placeholder="Username" required>
<div id="usernameError" class="error-message"></div>
<input type="email" id="email" name="email" placeholder="Email" required>
<div id="emailError" class="error-message"></div>
<input type="password" id="password" name="password" placeholder="Password" required>
<div id="passwordError" class="error-message"></div>
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm Password" required>
<div id="confirmPasswordError" class="error-message"></div>
<button type="submit">Sign Up</button>
<div id="successMessage" class="success-message"></div>
</form>
<div class="login-link">
<p>Already have an account? <a href="login.html">Login here</a></p>
</div>
</div>
<script>
const form = document.getElementById('signupForm');
const usernameInput = document.getElementById('username');
const emailInput = document.getElementById('email');
const passwordInput = document.getElementById('password');
const confirmPasswordInput = document.getElementById('confirmPassword');
const usernameError = document.getElementById('usernameError');
const emailError = document.getElementById('emailError');
const passwordError = document.getElementById('passwordError');
const confirmPasswordError = document.getElementById('confirmPasswordError');
const successMessage = document.getElementById('successMessage');
form.addEventListener('submit', (e) => {
e.preventDefault();
let valid = true;
// Clear previous error messages
usernameError.textContent = '';
emailError.textContent = '';
passwordError.textContent = '';
confirmPasswordError.textContent = '';
successMessage.textContent = '';
// Username validation
if (usernameInput.value.length < 3) {
usernameError.textContent = 'Username must be at least 3 characters long.';
valid = false;
}
// Email validation
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(emailInput.value)) {
emailError.textContent = 'Please enter a valid email address.';
valid = false;
}
// Password validation
if (passwordInput.value.length < 6) {
passwordError.textContent = 'Password must be at least 6 characters long.';
valid = false;
}
// Confirm password validation
if (passwordInput.value !== confirmPasswordInput.value) {
confirmPasswordError.textContent = 'Passwords do not match.';
valid = false;
}
// If the form is valid, show success message and redirect
if (valid) {
successMessage.textContent = 'Signup successful!';
form.reset();
setTimeout(() => {
window.location.href = 'index.html'; // Redirect to index.html after 2 seconds
}, 1000); // Adjust the timing as needed
}
});
</script>
<script>
window.embeddedChatbotConfig = {
chatbotId: "j2Uy2CrJfZueGX7wNtJT_",
domain: "www.chatbase.co"
}
</script>
<script
src="https://www.chatbase.co/embed.min.js"
chatbotId="j2Uy2CrJfZueGX7wNtJT_"
domain="www.chatbase.co"
defer>
</script>
</body>
</html>