forked from imran120198/Orbitz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate account.html
182 lines (151 loc) · 5.26 KB
/
create account.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
<!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>Create Account</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
}
#navbar {
width: 100%;
height: 40px;
border-bottom: .5px solid rgb(202, 199, 199);
display: flex;
margin: auto;
margin-top: 10px;
justify-content: center;
}
#navbar i {
padding-left: 20px;
padding-top: 6px;
font-size: 24px;
color: rgb(79, 148, 79);
}
#navbar:nth-child(2) {
width: 162px;
height: 31x;
margin: auto;
}
#navbar>div img {
width: 162.6px;
height: 31px;
}
#navbar+div {
width: 10%;
padding-left: 22%;
}
/* Navbar related css */
/* Form related css */
input,
select {
display: block;
margin: 15px 0px;
font-size: 20px;
padding: 2%;
width: 120%;
}
option {
font-size: 25px;
}
form {
width: 400px;
margin: 3% auto;
padding: 3%;
background: white;
}
p {
text-align: center;
margin-top: 10%;
}
a {
color: teal;
}
#submit {
font-size: 30px;
background-color: #c83259;
border-radius: 2%;
}
i {
font-size: 24px;
margin-left: 20px;
}
/* Form related css */
#sendingMessage {
color: red;
margin-top: -10px;
margin-bottom: -10px;
}
</style>
</head>
<body>
<div id="navbar">
<!-- <div><a href="signin.html"><i class="fa-solid fa-arrow-left"> </i></a></div> -->
<div><a href="index.html"><img src="https://www.orbitz.com/_dms/interstitial/logo.svg?locale=en_US&siteid=70201" alt=""></a></div>
</div>
<main>
<form action="" id="form">
<h1>Create an account</h1>
<input placeholder="E-Mail" type="email" name="email" id="email" />
<p id="sendingMessage"></p>
<input placeholder="First Name" id="firstName" name="name" type="text" />
<input placeholder="Last Name" type="text" name="lastName" id="lastName" />
<input placeholder="Password" type="password" name="password" id="password" />
<p>By creating an account, I agree to the Orbitz <a href="https://www.orbitz.com/lp/lg-privacy">Terms and Conditions, Privacy Statement and Orbitz Rewards Terms and Conditions.</a></p>
<input id="submit" type="submit" name="Submit" value="Continue" />
<p>Already have an account? <a href="signin.html">Sign in</a></p>
<p>or continue with</p>
<p> <i class="fa-brands fa-apple"></i><i class="fa-brands fa-facebook"></i></p>
</form>
</main>
</body>
</html>
<script>
document.querySelector("#form").addEventListener("submit", formfumction)
var userDataBase = JSON.parse(localStorage.getItem("userDataBase")) || [];
var bookedHotels = [];
var currentUser = [];
localStorage.setItem("User", JSON.stringify(currentUser))
function formfumction() {
event.preventDefault();
// taking info from user
var email = document.querySelector("#email").value;
var firstName = document.querySelector("#firstName").value;
var lastName = document.querySelector("#lastName").value;
var password = document.querySelector("#password").value;
//checking if user already exist
let exist = 0;
userDataBase.map(function (elem) {
if (elem.Email === email) {
exist = 1;
document.querySelector("#sendingMessage").innerHTML = "account with this email already exist"
window.open("signin.html", "_self");
}
})
//if user doesn't exist
if (exist === 0) {
var userDataBaseobj = {
Email: email,
FirstName: firstName,
LastName: lastName,
Password: password,
}
userDataBase.push(userDataBaseobj);
// console.log( userDataBaseobj);
localStorage.setItem("userDataBase", JSON.stringify(userDataBase));
//creating saperate object for user,all info related to user will be stored here
localStorage.setItem(email, JSON.stringify(bookedHotels));
window.open("signin.html", "_self");
// console.log(`${email}`)
}
}
</script>