-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedited-website.js
113 lines (101 loc) · 2.66 KB
/
edited-website.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
104
105
106
107
108
109
110
111
112
var user;
function openpopup()
{
document.getElementById("loginform").reset();
document.getElementById("SignIn").style.visibility= "visible";
}
function closepopup()
{
document.getElementById("SignIn").style.visibility= "hidden";
}
function opensignup()
{
document.getElementById("SignUp").style.visibility= "visible";
}
function opensignupfromlogin()
{
document.getElementById("signupform").reset();
document.getElementById("SignIn").style.visibility= "hidden"
document.getElementById("SignUp").style.visibility= "visible";
}
function openpopupfromsignup()
{
document.getElementById("loginform").reset();
document.getElementById("SignUp").style.visibility= "hidden";
document.getElementById("SignIn").style.visibility= "visible";
}
function closesignup()
{
document.getElementById("SignUp").style.visibility = "hidden";
}
let bool=1;
function validatelogin()
{
user = document.getElementById("username").value;
var pass = document.getElementById("password").value;
const a = (localStorage.getItem(`${user}`));
if (a === "") {
swal("Wrong Details", "Invalid Username or Password", "error");
return false;
//yaha pe kuch daal dena agar no input to
}
else {
if (a === pass) {
swal(
"Log In Succesfull!",
"Welcome, to the Bookxchange " + user + "!",
"success"
);
bool=0;
closepopup();
// document.getElementById("submitonlogin").reset();
edit_details();
// window.location.href = "index.html";
}
else {
swal("Wrong Details", "Invalid Username or Password", "error");
}
}
}
function check(){
console.log(bool)
if (bool==1)
{
openpopup()
}
else{
window.location.href = "Accomodation.html";
return false;
}
}
function callsignup()
{
let usernmame = document.getElementById("usernamesignup").value;
let password = document.getElementById("passwordsignup").value;
localStorage.setItem(usernmame,password);
}
function edit_details()
{
document.getElementById("nav1").style.visibility = "hidden";
document.getElementById("nav2").style.visibility = "visible";
document.getElementById("name").innerHTML =`${user}`;
}
function signout()
{
swal({
title: 'Are you sure?',
text: "You will be Logged Out !",
type: 'warning',
showCancelButton: true,
confirmButtonColor:'#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then(function() {
swal(
'Signed Out!',
'Youhave been signed out',
'success'
);
location.reload();
})
}