integ webcredentials

This commit is contained in:
Valentin CZERYBA 2023-10-20 22:24:13 +02:00
parent 1bc043dd5e
commit 326b21a65c
2 changed files with 4 additions and 3 deletions

View File

@ -1 +1 @@
const instance = axios.create({ baseURL: 'http://localhost:8083'}); const instance = axios.create({ baseURL: 'http://localhost:8083', withCredentials: true});

View File

@ -7,8 +7,9 @@ document.getElementById("signin").addEventListener("submit", function(evt){
var password = document.getElementById("floatingPassword"); var password = document.getElementById("floatingPassword");
if((password.value.length > 0) || (pseudo.value.length > 0)){ if((password.value.length > 0) || (pseudo.value.length > 0)){
authData = {username: pseudo.value, password: password.value} 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' }}, { withCredentials: true}) 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"; }) .then(function(response) {
location.href="html/users.html"; })
.catch(function(error){ .catch(function(error){
switch (error.response.status){ switch (error.response.status){