diff --git a/web/js/login.js b/web/js/login.js index 9fb6a49..8b5a898 100644 --- a/web/js/login.js +++ b/web/js/login.js @@ -9,7 +9,13 @@ document.getElementById("signin").addEventListener("submit", function(evt){ authData = {username: pseudo.value, password: password.value} instance.post("token", {username: pseudo.value, password: password.value}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' }}) .then(function(response) { - location.href="html/users.html"; }) + if(response.data["roles"] == "Admin"){ + location.href="html/users.html"; + } + else { + instance.delete("token") + } + }) .catch(function(error){ switch (error.response.status){