-
Notifications
You must be signed in to change notification settings - Fork 0
/
signIn.js
103 lines (84 loc) · 3.14 KB
/
signIn.js
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
var myUserData = JSON.parse(localStorage.getItem("userCreds")) || [];
document.querySelector("#form2").addEventListener("submit",myLogin)
function myLogin(){
event.preventDefault();
var contact = document.querySelector("#phone").value;
var code = document.querySelector("#verCode").value;
for(var i=0;i<myUserData.length;i++){
if(myUserData[i].contact === contact){
if(myUserData[i].password === code){
alert("Login Successful");
break;
}
else{
alert("Login Failed!");
}
}
}
}
document.querySelector("#form2").addEventListener("submit",loginbygmail)
function loginbygmail(){
var contact = document.querySelector("#passphone").value;
var code = document.querySelector("#passPassword").value;
for(var i=0;i<myUserData.length;i++){
if(myUserData[i].contact === contact){
if(myUserData[i].password === code){
alert("Login Successful");
window.location.href="index.html"
break;
}
else{
alert("Login Failed!");
}
}
}
}
document.getElementById("scanButton").addEventListener("click",myFunction)
function myFunction() {
var x = document.getElementById("detailsdiv1");
var y = document.getElementById("detailsdiv2");
console.log("working !");
if(x.style.display === "block"){
x.style.display = "none";
y.style.display = "block";
document.getElementById("scanButton").innerHTML = "Sign In";
}
else if(y.style.display === "block"){
y.style.display = "none";
x.style.display = "block";
document.getElementById("scanButton").innerHTML = "Sign In";
}
}
document.getElementById("js2").addEventListener("click",myForgotPassword)
function myForgotPassword() {
var signInA = document.getElementById("inputCreds");
var signInB = document.getElementById("passinputCreds");
console.log(signInA,signInB);
if(signInB.style.display === "none"||signInB.style.display==""){
signInA.style.display = "none";
signInB.style.display = "block";
document.getElementById("js2").innerHTML = "Sign In";
}
// else if(y.style.display === "block"){
// signInB.style.display = "none";
// signInA.style.display = "block";
// document.getElementById("js2").innerHTML = "Sign In";
// }
}
document.getElementById("verbutton").addEventListener("click",myVerificationPassword)
function myVerificationPassword() {
console.log("working")
var A = document.getElementById("inputCreds");
var B = document.getElementById("passinputCreds");
console.log("working !");
if(B.style.display === "block"||B.style.display=="none"){
B.style.display = "none";
A.style.display = "block";
document.getElementById("js2").innerHTML = "Sign In";
}
// else if(y.style.display === "block"){
// B.style.display = "none";
// A.style.display = "block";
// document.getElementById("js2").innerHTML = "Sign In";
// }
}