-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.html
274 lines (263 loc) · 9.4 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hollyhotel Hotel & Resort | Register</title>
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<link href="css/responsive.css" rel="stylesheet" />
<link href="css/color.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com" rel="preconnect" />
<link crossorigin="" href="https://fonts.gstatic.com" rel="preconnect" />
<link href="css/css2.css" rel="stylesheet" />
<link
href="assets/images/favicon.png"
rel="shortcut icon"
type="image/x-icon"
/>
<link href="assets/images/favicon.png" rel="icon" type="image/x-icon" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
name="viewport"
/>
<script
src="/js/cdn.js"
id="mepaas-rewards"
api-key="y3krjw44aq7kkwixupd0j"
></script>
</head>
<body>
<div class="page-wrapper">
<header class="main-header header-style-one">
<div class="header-top">
<div class="auto-container">
<div class="header-top-wrapper-box">
<div class="header-top-left-column">
<ul class="header-top-social-links">
<li>
<a href="#"><i class="fab fa-facebook-f"></i></a>
</li>
<li>
<a href="#"><i class="fab fa-twitter"></i></a>
</li>
<li>
<a href="#"><i class="fab fa-linkedin-in"></i></a>
</li>
<li>
<a href="#"><i class="fab fa-instagram"></i></a>
</li>
</ul>
</div>
<div class="header-top-right-column">
<div class="header-top-text">
Clock: Mon - Sat 8:00 - 6:30, Sunday - <span>CLOSED</span>
</div>
</div>
</div>
</div>
</div>
<div class="header-upper">
<div class="auto-container">
<div class="inner-container">
<div class="logo-box">
<div class="logo">
<a href="index.html"
><img alt="" src="images/logo-dark.png"
/></a>
</div>
</div>
<div class="nav-outer">
<div class="mobile-nav-toggler">
<img alt="" src="images/icon-bar.png" />
</div>
<nav class="main-menu navbar-expand-md navbar-light">
<div
class="collapse navbar-collapse show clearfix"
id="navbarSupportedContent"
>
<ul class="navigation">
<li class="dropdown">
<a href="index.html">Home</a>
</li>
<li class="dropdown">
<a href="index.html">Rooms</a>
</li>
<li class="dropdown">
<a href="index.html">Blog</a>
</li>
<li><a href="index.html">Contact</a></li>
</ul>
</div>
</nav>
</div>
<div class="right-column">
<div class="navbar-right">
<div class="link-btn">
<a class="btn-one" href="login.html">Login <span></span></a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sticky-header">
<div class="header-upper">
<div class="auto-container">
<div class="inner-container">
<div class="logo-box">
<div class="logo">
<a href="index.html"
><img alt="" src="images/logo-dark.png"
/></a>
</div>
</div>
<div class="nav-outer">
<div class="mobile-nav-toggler">
<img alt="" src="images/icon-bar.png" />
</div>
<nav class="main-menu navbar-expand-md navbar-light"></nav>
</div>
<div class="right-column">
<div class="navbar-right">
<div class="link-btn">
<a class="btn-one" href="login.html"
>Login <span></span
></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mobile-menu">
<div class="menu-backdrop"></div>
<div class="close-btn"><i class="icon far fa-times"></i></div>
<nav class="menu-box">
<div class="nav-logo">
<a href="index.html"
><img alt="" src="images/logo-light.png" title=""
/></a>
</div>
<div class="menu-outer"></div>
<div class="social-links">
<ul class="clearfix">
<li>
<a href="#"><span class="fab fa-twitter"></span></a>
</li>
<li>
<a href="#"><span class="fab fa-facebook-square"></span></a>
</li>
<li>
<a href="#"><span class="fab fa-pinterest-p"></span></a>
</li>
<li>
<a href="#"><span class="fab fa-instagram"></span></a>
</li>
<li>
<a href="#"><span class="fab fa-youtube"></span></a>
</li>
</ul>
</div>
</nav>
</div>
<div class="nav-overlay">
<div class="cursor"></div>
<div class="cursor-follower"></div>
</div>
</header>
<section class="form-wrapper">
<h2>Register</h2>
<form id="loginForm">
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" placeholder="Enter email address" />
</div>
<div class="form-group">
<label for="email">Password</label>
<input type="password" id="password" placeholder="email address" />
</div>
<button type="submit">Register</button>
</form>
</section>
</div>
<!-- <script src="js/cdn.js"></script> -->
<script>
document
.getElementById("loginForm")
.addEventListener("submit", async (event) => {
event.preventDefault();
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
// Retrieve existing users from local storage or initialize as an empty array
const existingUsers =
JSON.parse(localStorage.getItem("existing-users")) || [];
// Check if the user already exists
const userExists = existingUsers.includes(email);
if (true) {
// Add the new user to local storage
existingUsers.push(email);
localStorage.setItem(
"existing-users",
JSON.stringify(existingUsers)
);
const payload = {
user: {
id: `user-${Date.now()}`,
email: email,
name: email,
createdAt: new Date().toISOString(),
lastLoginDate: new Date().toISOString(),
totalOrders: 0,
totalSpend: 0,
totalPoints: 0,
status: "active",
},
type: "sign_up",
};
try {
const apiKey = localStorage.getItem("apiKey");
// Make API call
const response = await fetch(
"https://paas.meappbounty.com/v1/api/earning/brand/event/push",
{
method: "POST",
headers: {
accept: "*/*",
"x-public-key": apiKey,
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify(payload),
}
);
if (!response.ok) {
throw new Error("Failed to log in. Please try again.");
}
const data = await response.json();
console.log("API Response:", data);
} catch (error) {
console.error("Error:", error);
alert("An error occurred during login.");
return;
}
} else {
console.log(
"User already exists in local storage. Skipping API call."
);
}
// Save email to local storage and redirect
localStorage.setItem("email", email);
window.setCustomerData({
email,
id: "dfddd",
firstName: "Name",
lastName: "Last Name",
});
window.location.href = "/index.html";
});
</script>
</body>
</html>