-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
72 lines (68 loc) · 3.32 KB
/
admin.html
File metadata and controls
72 lines (68 loc) · 3.32 KB
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
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Garamante | Pannello di controllo</title>
<meta name="description" content="Pannello di controllo di garamante.it">
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./node_modules/jquery.session/jquery.session.js"></script>
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css" media="print" onload="this.media='all'">
<link rel="stylesheet" href="./node_modules/bootstrap-icons/font/bootstrap-icons.css" media="print" onload="this.media='all'">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles/stylesheet.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500&display=swap');
</style>
</head>
<body style="background-color: black;">
<section class="position-relative py-4 py-xl-5">
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-10 col-sm-10 col-md-8 col-lg-8 col-xl-6" style="max-width: 500px">
<div class="card mb-5 form-card">
<div class="card-body d-flex flex-column align-items-center">
<h1 class="my-5">garamanteCMS</h1>
<form class="text-center w-100" style="max-width: 375px" id="loginForm">
<div class="mb-3 mt-2"><input id="emailField" class="form-control" type="text" name="email"
placeholder="Username" autocomplete="email"></div>
<div class="mb-4"><input id="passwordField" class="form-control" type="password"
name="password" placeholder="Password"
autocomplete="current-password"></div>
<button class="btn btn-primary d-block w-100 mb-2" type="submit">Accedi</button>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="fixed-bottom text-center">
<a class="footer-text" href="https://garamante.it">garamante.it</a>
</footer>
<script>
$("#loginForm").on("submit", function (event) {
event.preventDefault();
$.post("./api/login.php", {
username: $("#emailField").val(),
password: $("#passwordField").val()
})
.done(function (data) {
let userInfo = JSON.parse(data);
if (userInfo.user_id != null) {
$.session.set("user_id", userInfo.user_id);
$.session.set("username", userInfo.username);
$.session.set("email", userInfo.email);
$.session.set("firstName", userInfo.firstName);
$.session.set("lastName", userInfo.lastName);
window.location.href = "dashboard.html";
} else {
$("#emailField").addClass("is-invalid");
$("#passwordField").addClass("is-invalid");
alert("Credenziali errate");
}
});
});
</script>
</body>
</html>