-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginPage.html
90 lines (76 loc) · 2.58 KB
/
LoginPage.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
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Login Page with Background Image Example</title>
<link rel="stylesheet" href="./logstyle.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div id="bg"></div>
<form>
<div class="form-field">
<input type="email" id="ids" placeholder="Email / Username" required/>
</div>
<div class="form-field">
<input type="password" id="otp" placeholder="OTP" required/>
</div>
<div class="form-field">
<button class="btn" id="subbtn" type="submit">Send Otp</button>
<button class="btn" id="loginbtn" type="submit">Submit</button>
</div>
</form>
<div id="msgbox">Email Not Found</div>
<!-- partial -->
<script>
document.querySelector("#subbtn").addEventListener("click",function(e){
var adminid = document.querySelector("#ids").value
if(adminid == "dheerajsharma782@gmail.com"){
document.querySelector("#otp").style.display="block";
this.style.display="none"
e.preventDefault();
obj = {
id:document.querySelector("#ids").value
}
var url = "https://script.google.com/macros/s/AKfycbyR4VGSYM9agmAnCaq64lJJC7IqWkdilmbSKaHQqKxa1nmOLl-OWOefa8Gfcp3VIvq2/exec"
fetch(url,{
method: 'POST',
body: JSON.stringify(obj),
})
.then((response) =>{
alert("Success!");
document.querySelector("#loginbtn").style.display="block";
response.text();
})
.then((data) => console.log(data));
}else{
document.querySelector("#msgbox").style.display="block";
setTimeout(function(){
document.querySelector("#ids").value="";
document.querySelector("#msgbox").style.display="none";
},1000)
}
});
</script>
<script>
document.querySelector("#loginbtn").addEventListener("click",function(e){
this.innerHTML="Checking";
e.preventDefault();
var inputotp = document.querySelector("#otp").value
var url = "https://script.google.com/macros/s/AKfycbyR4VGSYM9agmAnCaq64lJJC7IqWkdilmbSKaHQqKxa1nmOLl-OWOefa8Gfcp3VIvq2/exec"
fetch(url)
.then(response => {
return response.json();
}).then(function(data){
var totalRow = data.contents.length;
var otpfromss = data.contents[totalRow-1][0];
if(inputotp == otpfromss){
window.location.assign("https://docs.google.com/forms/d/e/1FAIpQLScNRtviq2SxrA4BOCBEeMk8O9dfk5qaJ-bYcE9muVebLaO8xg/viewform")
}else{
document.querySelector("#loginbtn").innerHTML="Wrong Otp Resubmit";
}
})
})
</script>
</body>
</html>