From 1bd9397c0e4b0c70da28e155b7e4391f7a4aa30d Mon Sep 17 00:00:00 2001 From: Katerina Iatropoulou Date: Tue, 20 Oct 2020 14:13:44 +0000 Subject: [PATCH] Check for empty keys + form does not lose values --- .../openaire/usermanagement/RegisterServiceServlet.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServiceServlet.java b/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServiceServlet.java index 8403765..b248bee 100644 --- a/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServiceServlet.java +++ b/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServiceServlet.java @@ -79,6 +79,7 @@ public class RegisterServiceServlet extends HttpServlet { Gson gson = new GsonBuilder().registerTypeAdapter(Jwks.class, new JwksDeserializer()).create(); jwks = gson.fromJson(jwksString, Jwks.class); if (jwks.getKeys()==null || jwks.getKeys().length==0) { + System.out.println("Something wrong with the keys."); request.getSession().setAttribute("msg_key_value_error_display", "display:block"); canProceed = false; } @@ -125,7 +126,13 @@ public class RegisterServiceServlet extends HttpServlet { } else { //something is wrong with the form and the error messages will appear - response.sendRedirect("./registeredServices"); + request.getSession().setAttribute("first_name", name); + request.getSession().setAttribute("description", description); + request.getSession().setAttribute("key_radio", keyType); + request.getSession().setAttribute("uri", jwksUri); + request.getSession().setAttribute("value", jwksString); + + response.sendRedirect("./registerService"); return; }