fix: devWeb - error diplay unified

This commit is contained in:
kmitresse
2024-04-27 11:08:37 +02:00
parent 72769670cf
commit bffb5eb5f1
2 changed files with 18 additions and 2 deletions
@@ -60,7 +60,7 @@ public class ForgottenPasswordServlet extends HttpServlet {
if (forgottenPasswordBean.validate(uri)) {
httpResponse = new HttpResponse(HttpResponseCode.OK, "Mail sent");
} else {
httpResponse = new HttpResponse(HttpResponseCode.NOT_FOUND, "<strong>Erreur:</strong> L'email renseigné est inconnu de nos services.");
httpResponse = new HttpResponse(HttpResponseCode.NOT_FOUND, "L'email renseigné est inconnu de nos services.");
}
out.println(gson.toJson(httpResponse));
@@ -60,8 +60,24 @@
// Notification
const notification = document.createElement("div");
notification.classList.add("notification", "is-danger");
notification.innerHTML = error.message;
const notificationTitle = document.createElement("p");
notificationTitle.classList.add("title", "is-6");
notificationTitle.innerHTML = "Erreur";
const notificationIcon = document.createElement("span");
notificationIcon.classList.add("icon");
notificationIcon.innerHTML = "<i class='fas fa-exclamation-triangle'></i>";
const notificationMessage = document.createElement("p");
notificationMessage.classList.add("subtitle", "is-6");
notificationMessage.innerHTML = error.message;
notificationTitle.appendChild(notificationIcon);
notification.appendChild(notificationTitle);
notification.appendChild(notificationMessage);
document.body.appendChild(notification);
setTimeout(() => notification.remove(), 5010);
}