diff --git a/web/css/signin.css b/web/css/signin.css index 4732d1f..71c31f4 100644 --- a/web/css/signin.css +++ b/web/css/signin.css @@ -37,3 +37,7 @@ body { border-top-left-radius: 0; border-top-right-radius: 0; } + +.hidden { + visibility: hidden; +} \ No newline at end of file diff --git a/web/index.html b/web/index.html index 9012602..d40caee 100644 --- a/web/index.html +++ b/web/index.html @@ -49,13 +49,18 @@
+ +

Please sign in

- - + +
diff --git a/web/js/login.js b/web/js/login.js index 399ee81..5e8db9e 100644 --- a/web/js/login.js +++ b/web/js/login.js @@ -6,9 +6,20 @@ instance.get("token", { withCredentials: true}) document.getElementById("signin").addEventListener("submit", function(evt){ evt.preventDefault(); - var email = document.getElementById("floatingEmail"); + var pseudo = document.getElementById("floatingPseudo"); var password = document.getElementById("floatingPassword"); - if((password.value.length > 0) || (email.value.length > 0)){ - console.log("request"); + if((password.value.length > 0) || (pseudo.value.length > 0)){ + console.log(pseudo.value); + 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"); + } + }); } -}) \ No newline at end of file +}); + +document.getElementById("closeAlertPassword").addEventListener("click", function(){ + document.getElementById("alertPassword").classList.add("hidden"); +}); \ No newline at end of file