Check for empty keys + form does not lose values

This commit is contained in:
Katerina Iatropoulou 2020-10-20 14:13:44 +00:00
parent ca29c9ae67
commit 1bd9397c0e
1 changed files with 8 additions and 1 deletions

View File

@ -79,6 +79,7 @@ public class RegisterServiceServlet extends HttpServlet {
Gson gson = new GsonBuilder().registerTypeAdapter(Jwks.class, new JwksDeserializer()).create(); Gson gson = new GsonBuilder().registerTypeAdapter(Jwks.class, new JwksDeserializer()).create();
jwks = gson.fromJson(jwksString, Jwks.class); jwks = gson.fromJson(jwksString, Jwks.class);
if (jwks.getKeys()==null || jwks.getKeys().length==0) { 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"); request.getSession().setAttribute("msg_key_value_error_display", "display:block");
canProceed = false; canProceed = false;
} }
@ -125,7 +126,13 @@ public class RegisterServiceServlet extends HttpServlet {
} else { } else {
//something is wrong with the form and the error messages will appear //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; return;
} }