forked from Its-Aman-Yadav/Community-Site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.html
275 lines (250 loc) · 10.9 KB
/
login.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login/Signup</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
<link href="https://cdn.lineicons.com/4.0/lineicons.css" rel="stylesheet" />
<link rel="stylesheet" href="login.css" />
<link rel="icon" href="favicon.ico" />
<style>
/* Add styles for the success banners */
.success-banner {
display: none;
background-color: #4CAF50;
color: white;
padding: 15px;
text-align: center;
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
</style>
</head>
<body>
<!-- Success banners -->
<div id="loginSuccessBanner" class="success-banner">Logged in successfully</div>
<div id="registerSuccessBanner" class="success-banner">Registered successfully</div>
<!-- Chatbot integration section -->
<script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script>
<script>
window.botpressWebChat.init({
composerPlaceholder: "Ask me anything!",
botConversationDescription: "Welcome to Open Source Village!",
botId: "88f3d139-4a56-4ac6-a192-d147bc4373d7",
hostUrl: "https://cdn.botpress.cloud/webchat/v1",
messagingUrl: "https://messaging.botpress.cloud",
clientId: "88f3d139-4a56-4ac6-a192-d147bc4373d7",
webhookId: "a909bd46-1d71-484d-8551-58afe6d64c1e",
lazySocket: true,
themeName: "prism",
botName: "Open Source Village",
avatarUrl: "https://media.licdn.com/dms/image/D4D0BAQE8E3S0-vt8TQ/company-logo_200_200/0/1683703353326?e=1724889600&v=beta&t=to32718A4rdNZM_XmtjHN8xG4LKE9UYLhVnuoyB3nt8",
stylesheet: "https://webchat-styler-css.botpress.app/prod/328bf234-c9e7-4f98-9c94-69f1a0877b98/v99808/style.css",
frontendVersion: "v1",
useSessionStorage: true,
enableConversationDeletion: true,
theme: "prism",
themeColor: "#2563eb",
allowedOrigins: [],
});
</script>
<div class="container" id="container">
<div class="form-container register-container">
<form id="registerForm">
<h1>Open Source Village</h1>
<input type="text" placeholder="Name" id="registerName" />
<input type="email" placeholder="Email" id="registerEmail" />
<div class="input-container">
<input type="password" placeholder="Password" id="registerPassword" />
<i class="far fa-eye-slash" id="toggleRegisterPassword" style="cursor: pointer"></i>
</div>
<button type="submit">Register</button>
<div class="social-container">
<a id="fb" href="https://www.facebook.com" class="social"
><i class="lni lni-facebook-fill"></i
></a>
<a id="goog" href="https://www.google.com" class="social"
><i class="lni lni-google"></i
></a>
<a id="lin" href="https://www.linkedin.com/company/open-source-village/" class="social"
<a href="https://www.linkedin.com/company/open-source-village/" class="social"
<a id="lin" href="https://www.linkedin.com" class="social"
><i class="lni lni-linkedin-original"></i
></a>
</div>
</form>
</div>
<div class="form-container login-container">
<form id="loginForm">
<h1>Open Source Village</h1>
<input type="email" placeholder="Email" id="loginEmail" />
<div class="input-container">
<input type="password" placeholder="Password" id="loginPassword" />
<i class="far fa-eye-slash" id="togglePassword" style="cursor: pointer"></i>
</div>
<div class="content">
<div class="checkbox">
<input type="checkbox" name="checkbox" id="checkbox" />
<label>Remember me</label>
</div>
<div class="pass-link">
<a href="./Forgot_Password.html">Forgot password?</a>
<!-- Redirects to Forgot_Password.html when hypertext is clicked-->
</div>
</div>
<button type="submit">Login</button>
<span>or use your account</span>
<div class="social-container">
<a id="fb" href="https://www.facebook.com" class="social"
><i class="lni lni-facebook-fill"></i
></a>
<a id="goog" href="https://www.google.com" class="social"
><i class="lni lni-google"></i
></a>
<a id="lin" href="https://www.linkedin.com" class="social"
<a href="https://www.linkedin.com/" class="social"
<a id="lin" href="https://www.linkedin.com" class="social"
><i class="lni lni-linkedin-original"></i
></a>
</div>
</form>
</div>
<div class="overlay-container">
<div class="overlay">
<div class="overlay-panel overlay-left">
<h1 class="title"><br /></h1>
<p>If you have an account already, login here.</p>
<button class="ghost" id="login">
Login
<i class="lni lni-arrow-left login"></i>
</button>
</div>
<div class="overlay-panel overlay-right">
<h1 class="title">
Start your <br />
journey now
</h1>
<p>If you don't have an account yet, register and start your journey.</p>
<button class="ghost" id="register">
Register
<i class="lni lni-arrow-right register"></i>
</button>
<button class="ghost" id="home">
<i class="lni lni-arrow-left register"></i>
<a style="color: white;" href="index.html">Home</a>
</button>
</div>
</div>
</div>
</div>
<script src="log/script.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const registerButton = document.getElementById("register");
const loginButton = document.getElementById("login");
const container = document.getElementById("container");
const loginSuccessBanner = document.getElementById("loginSuccessBanner");
const registerSuccessBanner = document.getElementById("registerSuccessBanner");
registerButton.addEventListener("click", (event) => {
event.preventDefault();
container.classList.add("right-panel-active");
document.getElementById("registerForm").scrollIntoView({ behavior: "smooth" });
});
loginButton.addEventListener("click", (event) => {
event.preventDefault();
container.classList.remove("right-panel-active");
document.getElementById("loginForm").scrollIntoView({ behavior: "smooth" });
});
// Form validation and submission
document.getElementById("registerForm").addEventListener("submit", function (event) {
event.preventDefault();
validateForm("register");
});
document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault();
validateForm("login");
});
function validateForm(formType) {
let email, password, name;
const spcharRegex = /[<>"/]/;
if (formType === "register") {
name = document.getElementById("registerName").value;
email = document.getElementById("registerEmail").value;
password = document.getElementById("registerPassword").value;
if (name === "" || email === "" || password === "") {
alert("Please fill in all fields");
return;
}
if (!validateEmail(email)) {
alert("Please enter a valid email address");
return;
}
if (spcharRegex.test(name) || spcharRegex.test(password)) {
alert('Name Or Password Cannot Contain <,>,", or /');
return;
}
// Show register success banner
registerSuccessBanner.style.display = "block";
setTimeout(() => {
registerSuccessBanner.style.display = "none";
}, 3000);
} else {
email = document.getElementById("loginEmail").value;
password = document.getElementById("loginPassword").value;
if (email === "" || password === "") {
alert("Please fill in all fields");
return;
}
if (!validateEmail(email)) {
alert("Please enter a valid email address");
return;
}
if (spcharRegex.test(password)) {
alert('Password cannot contain <,>,", or /');
return;
}
// Show login success banner
loginSuccessBanner.style.display = "block";
setTimeout(() => {
loginSuccessBanner.style.display = "none";
}, 3000);
}
}
function validateEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
// Password toggle visibility for login
const togglePassword = document.getElementById("togglePassword");
const passwordInput = document.getElementById("loginPassword");
togglePassword.addEventListener("click", function () {
const type = passwordInput.getAttribute("type") === "password" ? "text" : "password";
passwordInput.setAttribute("type", type);
this.classList.toggle("fa-eye");
this.classList.toggle("fa-eye-slash");
});
// Password toggle visibility for register
const toggleRegisterPassword = document.getElementById("toggleRegisterPassword");
const passwordRegisterInput = document.getElementById("registerPassword");
toggleRegisterPassword.addEventListener("click", function () {
const type = passwordRegisterInput.getAttribute("type") === "password" ? "text" : "password";
passwordRegisterInput.setAttribute("type", type);
this.classList.toggle("fa-eye");
this.classList.toggle("fa-eye-slash");
});
});
</script>
<!-- Firebase App (the core Firebase SDK) -->
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js"></script>
<!-- Firebase Authentication -->
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-auth.js"></script>
<!-- Firebase Realtime Database -->
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-database.js"></script>
<!-- Our script must be loaded after firebase references -->
<script src="index.js"></script>
</body>
</html>