-
Notifications
You must be signed in to change notification settings - Fork 12
/
login.html
108 lines (108 loc) · 3.67 KB
/
login.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Log in to continue</title>
<script type="text/javascript" src="https://npmcdn.com/parse/dist/parse.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/Parking-Master/Simple-Alert@latest/simplealert.min.js"></script>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background: #444;
}
input {
position: relative;
width: 50%;
height: 20px;
padding: 5px;
left: 50%;
margin-left: -25%;
margin-bottom: 50px;
outline: none !important;
border: 2px solid #25750a;
background: #333;
color: #25750a;
}
.swal-modal {
background: #444;
box-shadow: 0px 0px 10px 5px #ff4444;
}
.swal-modal *, .swal-text {
color: #ff4444 !important;
}
.swal-button {
background: #ff4444 !important;
color: #333 !important;
box-shadow: none !important;
outline: none !important;
}
* {
color: #333;
}
h1 {
text-align: center;
color: #333;
text-shadow: 0 2px #25750a;
margin-top: 100px;
}
button#submit {
position: relative;
color: #333;
background: #25750a;
height: 30px;
padding: 5px;
display: inline-flex;
text-align: center;
justify-content: center;
align-items: center;
border: none !important;
outline: none !important;
width: 50%;
left: 50%;
margin-left: -25%;
cursor: default;
transition: background 1s;
}
button#submit:hover {
background: #ff4444;
}
p {
margin-bottom: 100px;
}
a {
color: #25750a;
}
</style>
</head>
<body>
<h1 style="position:relative;width:50%;display:inline-flex;align-items:center;text-align:center;justify-content:center;left:50%;margin-left:-25%;">Log in to <img src="favicon.ico" style="position:relative;width:4%;border-radius:100%;box-shadow:0 0 3.5px 2px #25750a" /></h1>
<p style="text-align:center;color:#333">or <a href="signup.html">Sign up</a></p>
<label for="username" style="position:relative;left:50%;margin-left:-25%;">Username</label>
<br>
<input id="username" minlength="3" type="text" />
<br>
<label for="password" style="position:relative;left:50%;margin-left:-25%;">Password</label>
<br>
<input id="password" minlength="8" type="password" />
<br>
<button onclick="logIn()" id="submit">Log in</button>
<script>
Parse.initialize("qEK42aDtmQiBXmIoRdojDAYrKXGj5w4h2QnNRpYz","J4IK0gqf8rQS8G8Hg5LDbz0oEASJtRlUS2LPiRVg"),Parse.serverURL="https://parseapi.back4app.com/";
function logIn() {
let user = Parse.User.logIn(document.getElementById("username").value, document.getElementById("password").value).then(function(user) {
swal("Logged in. Redirecting...");
localStorage.setItem("username", document.getElementById("username").value);
localStorage.setItem("password", document.getElementById("password").value);
localStorage.setItem("points", user.get("currentPoints"));
setTimeout(() => {
location.replace("./");
}, 1000);
}).catch(function(error) {
console.log(error);
swal("Error: Failed to login. Check your password and try again.\n\nError Code: " + error.code + (error.code==101?" (Could not retrieve information)":""));
});
}
</script>
</body>
</html>