forked from v4l3n71n/covas-bo
authentification
This commit is contained in:
parent
1eb459c44b
commit
db504120f9
@ -37,3 +37,7 @@ body {
|
|||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-top-right-radius: 0;
|
border-top-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
@ -49,13 +49,18 @@
|
|||||||
<body class="text-center">
|
<body class="text-center">
|
||||||
|
|
||||||
<main class="form-signin">
|
<main class="form-signin">
|
||||||
|
<div class="alert alert-danger alert-dismissible hidden" id="alertPassword" role="alert">
|
||||||
|
<div>Utilisateur inexistant ou mauvais mot de passe</div>
|
||||||
|
<button type="button" id="closeAlertPassword" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form id="signin">
|
<form id="signin">
|
||||||
<img class="mb-4" src="css/bootstrap-logo.svg" alt="" width="72" height="57">
|
<img class="mb-4" src="css/bootstrap-logo.svg" alt="" width="72" height="57">
|
||||||
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
|
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
|
||||||
|
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="email" class="form-control" id="floatingEmail" placeholder="name@example.com">
|
<input type="text" class="form-control" id="floatingPseudo" placeholder="Pseudo">
|
||||||
<label for="emailInput">Email address</label>
|
<label for="pseudoInput">Pseudo</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="password" class="form-control" id="floatingPassword" placeholder="Mot de passe">
|
<input type="password" class="form-control" id="floatingPassword" placeholder="Mot de passe">
|
||||||
|
@ -6,9 +6,20 @@ instance.get("token", { withCredentials: true})
|
|||||||
|
|
||||||
document.getElementById("signin").addEventListener("submit", function(evt){
|
document.getElementById("signin").addEventListener("submit", function(evt){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
var email = document.getElementById("floatingEmail");
|
var pseudo = document.getElementById("floatingPseudo");
|
||||||
var password = document.getElementById("floatingPassword");
|
var password = document.getElementById("floatingPassword");
|
||||||
if((password.value.length > 0) || (email.value.length > 0)){
|
if((password.value.length > 0) || (pseudo.value.length > 0)){
|
||||||
console.log("request");
|
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");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
document.getElementById("closeAlertPassword").addEventListener("click", function(){
|
||||||
|
document.getElementById("alertPassword").classList.add("hidden");
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user