diff --git a/web/index.html b/web/index.html index d40caee..bb97ea1 100644 --- a/web/index.html +++ b/web/index.html @@ -49,11 +49,30 @@
+ + + + + + +

Please sign in

diff --git a/web/js/login.js b/web/js/login.js index 5e8db9e..844a338 100644 --- a/web/js/login.js +++ b/web/js/login.js @@ -13,13 +13,39 @@ document.getElementById("signin").addEventListener("submit", function(evt){ instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true}) .then(function(response) { console.log(response) }) .catch(function(error){ - if(error.response.status == 404){ - document.getElementById("alertPassword").classList.remove("hidden"); + + switch (error.response.status){ + case 406: + id = "alertPassword"; + break; + case 404: + id = "alertUsername"; + break; + case 403: + id = "alertDisable"; + break; + case 410: + id = "alertToken"; + break; + default: + id = "alertUnknown"; + break; } + + document.getElementById(id).classList.remove("hidden"); + }); } }); -document.getElementById("closeAlertPassword").addEventListener("click", function(){ - document.getElementById("alertPassword").classList.add("hidden"); -}); \ No newline at end of file +var btnclose = document.getElementsByClassName("btn-close"); +for (var i = 0; i