flush -- WIP admin panel

This commit is contained in:
Tony Yang
2019-05-30 14:18:07 +08:00
parent 75af7df7b4
commit 84fb4180c9
53 changed files with 9104 additions and 2 deletions

19
include/js/security.js Normal file
View File

@@ -0,0 +1,19 @@
axios.defaults.withCredentials = true;
axios.interceptors.request.use(function (config) {
var crypto = window.crypto || window.msCrypto;
let csrfToken = btoa(String(crypto.getRandomValues(new Uint32Array(1))[0]));
document.cookie = `${axios.defaults.xsrfCookieName}=${csrfToken}`;
return config;
}, function (error) {
return Promise.reject(error);
});
$("#logout").on("click", function (e) {
e.preventDefault();
axios.get("login.php?logout").then(function (res) {
location.href = res.headers["axios-location"];
}).catch(function (error) {
console.log(error);
});
});