mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-13 17:11:49 +00:00
fix: dev-web - fix expiration token
This commit is contained in:
@@ -24,7 +24,7 @@ public class ResetPasswordServlet extends HttpServlet {
|
||||
response.sendRedirect(request.getContextPath() + "/forgotten-password?error=invalid-token");
|
||||
return;
|
||||
}
|
||||
if (token.getExpirationDate().compareTo(new java.util.Date()) > 0){
|
||||
if (token.getExpirationDate().compareTo(new java.util.Date()) < 0){
|
||||
response.sendRedirect(request.getContextPath() + "/forgotten-password?error=expired-token");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,3 @@
|
||||
const forgottenPasswordForm = document.getElementById("forgottenPasswordForm");
|
||||
|
||||
forgottenPasswordForm.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
//Recuperer les données du formulaire
|
||||
const formData = new FormData(forgottenPasswordForm);
|
||||
const data = {};
|
||||
formData.forEach((value, key) => data[key] = value);
|
||||
//Recuperer l'URL de l'action et la methode
|
||||
const action = forgottenPasswordForm.getAttribute("action");
|
||||
const method = forgottenPasswordForm.getAttribute("method");
|
||||
//Redirection vers le servlet ForgottenPasswordServlet
|
||||
fetch(action, {
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify(data),
|
||||
method,
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
// if (data.status === 200) window.location.href = data.redirect;
|
||||
})
|
||||
.catch(error => console.error("Error:", error))
|
||||
|
||||
});
|
||||
|
||||
window.onload = function (){
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
let error = null;
|
||||
|
||||
Reference in New Issue
Block a user