-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
95 lines (91 loc) · 3.8 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="src/css/login.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="temp/libraries/css/all.min.css">
<link rel="icon" href="src/images/logo.png">
<script src="lib/vue.js"></script>
<script src="src/js/akana.js"></script>
<script src="src/js/constants.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
const tkn = AkanaCookie.get('tkn');
if(tkn != null) window.location.replace("/messages.html");
let url = new URL(location.href);
const r = url.searchParams.get('r');
if(r != null && r == "0") {var msg = "You must authenticate yourself."};
</script>
<title>Login - Fesdone collection</title>
</head>
<body>
<div id="app">
<c-loader></c-loader>
<main>
<div class="form">
<div v-if="r != null && r == 0" class="form__errors">
<p>{{ msg }}</p>
</div>
<div class="form__content">
<h1>Log in</h1>
<ul>
<li>
<label for="username">Username</label>
<input v-model="username" type="text" id="username" placeholder="Enter your username">
</li>
<li>
<label for="password">Password</label>
<input v-model="password" type="password" id="password" placeholder="Enter your password">
</li>
<li class="button_section">
<button @click="submit" class="button">Connexion</button>
</li>
</ul>
</div>
<div class="form__footer">© 2021, Fesdone Collection</div>
</div>
</main>
</div>
<script src="src/components/header.js"></script>
<script src="src/components/loader.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
r: r,
msg: msg,
is_loading: false,
is_error: false,
username: "admin",
password: "admin",
},
methods: {
submit: function(){
let modal = document.querySelector(".modal__container");
modal.style.display = "block";
let form = {username: this.username, password: this.password};
axios.post(base_url + "/login/", form).then(response => {
modal.style.display = "none";
if(response.status == 400){
app.show_error_message(response.data['message']);
}
else if(response.status == 202){
AkanaCookie.set("tkn", response.data['message']);
window.location.replace("/messages.html");
}
});
},
show_error_message: function(message){
this.r = 0;
this.msg = message;
},
}
});
</script>
</body>
</html>