refactor(DevWeb): Edit Bean file to handle errors

This commit is contained in:
Lucàs
2024-04-20 21:20:24 +02:00
parent 8e954a0656
commit 8d6c0999c9
4 changed files with 35 additions and 20 deletions
@@ -46,10 +46,8 @@ public class LoginServlet extends HttpServlet {
httpResponse = new HttpResponse(HttpResponseCode.OK, "Login success");
} else {
httpResponse = new HttpResponse(HttpResponseCode.UNAUTHORIZED, "<strong>Erreur de connexion:</strong> Le nom d'utilisateur ou le " +
"mot de passe est incorrect.");
httpResponse = loginBean.getError();
}
out.println(gson.toJson(httpResponse));
out.flush();
}
@@ -51,7 +51,7 @@ public class RegisterServlet extends HttpServlet {
"Register success"
);
} else {
httpResponse = new HttpResponse(HttpResponseCode.UNAUTHORIZED, registerBean.getErrorMessage());
httpResponse = registerBean.getError();
}
out.println(gson.toJson(httpResponse));