forked from vasukomuravelli/Flipkart_Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.html
229 lines (195 loc) · 6.64 KB
/
sample.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="https://static-assets-web.flixcart.com/www/promos/new/20150528-140547-favicon-retina.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link rel="stylesheet" href="./style/style.css" />
<title>Login/Signup</title>
<style>
body{
justify-content:center;
align-items:center;
text-align:center;
}
#login_container{
display:flex;
border:1px solid #2874f0;
height:500px;
width:50%;
margin:10%;
margin-left:25%;
margin-right:25%;
margin-top:15px;
margin-bottom:5px;
}
#login_left{
max-height:100%;
width:50%;
}
#login_right{
padding:3%;
text-align:left;
max-height:100%;
width:50%;
margin:1%;
}
#login_container input{
width:95%;
font-size:20px;
padding:1%;
margin-bottom:8%;
}
button{
width:100%;
height:15%;
text-align:center;
margin-top:5%;
padding:2%;
font-size:18px;
border-radius:7px;
border:0px;
cursor:pointer;
}
img{
object-fit:fill;
height:100%;
width:100%;
}
#ls{
display:none;
}
#otpbox{
display:none;
}
#bosign{
display:none;
}
/* beginning of navbar/footer css*/
/* end of navbar/footer css */
</style>
</head>
<body>
<div class="navbar"></div>
<!-- <img src="https://i.postimg.cc/SRBF0gnr/Screenshot-161.jpg" style="width:100%;object-fit:contain"/> -->
<!--end of navbar-->
<div id="login_container">
<div id="login_left">
<img id="im"src="https://i.postimg.cc/xTCvxhCN/q111.png"/>
</div>
<div id="login_right">
<div id="l">
<label>Enter Email</label><br>
<input id="emaill"type="text"><br>
<label>Enter Password</label><br>
<input id="passl"type="password"><br>
<label>By continuing, you agree to Flipkart's Terms of Use and Privacy Policy.</label>
<button onclick="login()"style="background-color:orange;color:white;margin-bottom:4%;">Login</button>
<label style="margin:48%;margin-bottom:5%;color:grey;"> OR </label>
<button style="background-color:white;color:blue;margin-bottom:4%;border:1px solid grey">Request OTP</button>
<label style="cursor:pointer;color:blue" onclick="signup()"> New to Flipkart? Create an account</label>
</div>
<div id="ls">
<label>Enter Username</label><br>
<input id="userr" type="text"/><br>
<label>Enter Email</label><br>
<input id="emailr" type="text"/><br>
<label>Enter New Password</label><br>
<input id="passr" type="password"/><br>
<label>By continuing, you agree to Flipkart's Terms of Use and Privacy Policy.</label><br>
<button id="botp" style="background-color:orange;color:white;margin-bottom:4%;"onclick="register()">Continue</button>
<button onclick="loginpage()" style="background-color:white;color:blue;margin-bottom:4%;border:1px solid grey">Existing User? Login</button>
</div>
</div>
</div>
<div class="flipkart_info"></div>
<div class="foot"></div>
<!-- <img src="https://i.postimg.cc/PJ2p28NT/Screenshot-160.jpg" style="width:100%;object-fit:contain"/> -->
</body>
<script>
var l_image=document.getElementById("im");
var ldw=document.getElementById("l");
var lds=document.getElementById("ls");
function signup(){
l_image.src="https://i.postimg.cc/DfRPYFWJ/q222.png";
ldw.style.display="none";
lds.style.display="block";
}
function loginpage(){
l_image.src="https://i.postimg.cc/xTCvxhCN/q111.png";
ldw.style.display="block";
lds.style.display="none";
}
function register(){
let data = {
email : document.getElementById("emailr").value,
password : document.getElementById("passr").value,
username : document.getElementById("userr").value,
}
fetch("https://flipkart-dummy-server.herokuapp.com/register",{
method : "POST",
body : JSON.stringify(data),
headers : {"content-type" : "application/json"}
}).then((res)=>{
res.json();
}).then((res)=>{
alert("user successfully registered");
loginpage();
}).catch((e)=>{
alert("Error :",e);
});
}
function login(){
let data = {
email : document.getElementById("emaill").value,
password : document.getElementById("passl").value,
}
fetch("https://flipkart-dummy-server.herokuapp.com/login",{
method : "POST",
body : JSON.stringify(data),
headers : {"content-type" : "application/json"}
}).then((res)=>{
return res.json();
}).then((res)=>{
console.log(res);
localStorage.setItem("token",JSON.stringify(res));
if(JSON.parse(localStorage.getItem("token")).token)
{
alert("user successfully Loggedin");
return window.location.href = "index.html";
}else{
return alert("Incorrect login credentials");
}
});
}
</script>
<script type="module">
import navbar from "./components/navbar.js";
import {footer,Flipkartinfo} from "./components/footer.js";
let nbar = document.querySelector(".navbar");
nbar.innerHTML = navbar();
let login_btn = document.querySelector(".login");
let login_drop = document.querySelector(".login_dropdown");
login_btn.onclick = function () {};
let more = document.querySelector(".more");
let micon = document.getElementById("micon");
more.onmouseenter = function(){
micon.innerText = "arrow_drop_up";
}
more.onmouseleave = function(){
micon.innerText = "arrow_drop_down";
}
let searchbar = document.getElementById("searchbox");
let output = document.getElementById("output");
searchbar.oninput = function(){
debounce(search,1000);
}
let info = document.querySelector(".flipkart_info")
info.innerHTML = Flipkartinfo();
// Footer
let foot = document.querySelector('.foot');
foot.innerHTML = footer();
</script>
</html>