mirror of
https://github.com/appen-isen/fermentardoise.git
synced 2026-01-18 16:17:27 +01:00
* begin appearance * update * update * add profile page * begin * add login and logout functionality * update index * update
30 lines
881 B
JavaScript
30 lines
881 B
JavaScript
function listener_login() {
|
|
if(getCookie('fermentardoise_session') != ""){
|
|
window.location.replace("index.html");
|
|
}
|
|
document.getElementById("form_login").addEventListener("submit", function (event) {
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
console.log("connexion");
|
|
let mail = document.getElementById("email").value;
|
|
let upwd = document.getElementById("pwd").value;
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'api.php/login',
|
|
data: {
|
|
email: mail,
|
|
pwd: upwd,
|
|
},
|
|
statusCode: {
|
|
400: function () {
|
|
$("#error-zone").removeClass("hidden");
|
|
}
|
|
}
|
|
}).done(() => {
|
|
window.location.replace("index.html");
|
|
});
|
|
});
|
|
}
|
|
|
|
listener_login();
|