diff --git a/curriculumsearch/src/main/java/com/roshka/controller/RRHHUserController.java b/curriculumsearch/src/main/java/com/roshka/controller/RRHHUserController.java index f81692c..9a89cf6 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/RRHHUserController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/RRHHUserController.java @@ -26,7 +26,7 @@ import java.util.concurrent.Executors; @Controller public class RRHHUserController { - private static final long REGISTER_CODE = 1234; + private static String REGISTER_CODE = "123456"; RRHHUserRepository rrhhUserRepository; @Autowired @@ -46,6 +46,15 @@ public class RRHHUserController { return "registration"; } + @PostMapping("/generarCodigoRegistro") + public RedirectView generarCodigoRegistro(Model model, RedirectAttributes redirectAttributes){ + RedirectView redirectView = new RedirectView("/home", true); + + REGISTER_CODE = RandomString.make(6); + redirectAttributes.addFlashAttribute("clave", REGISTER_CODE); + return redirectView; + } + @GetMapping("/login") public String getLogin(Model model, HttpServletRequest request) { if(request.getParameter("error")!=null){ @@ -57,8 +66,7 @@ public class RRHHUserController { @PostMapping("/process_register") public RedirectView processRegister(HttpServletRequest request, RRHHUser user, RedirectAttributes redirectAttributes) { RedirectView redirectView = new RedirectView("/register",true); - redirectAttributes.addFlashAttribute("success", "Datos actualizados"); - if(Long.parseLong(request.getParameter("registrationCode")) != REGISTER_CODE){ + if(!request.getParameter("registrationCode").equals(REGISTER_CODE)){ redirectAttributes.addFlashAttribute("error", "Codigo Incorrecto"); return redirectView; } @@ -140,6 +148,8 @@ public class RRHHUserController { }); emailExecutor.shutdown(); + model.addAttribute("success", "Se ha enviado el link de recuperación a su " + + "correo electronico. Si no lo recibió intente nuevamente."); return "forgot_password_form"; } diff --git a/curriculumsearch/src/main/webapp/jsp/forgot_password_form.jsp b/curriculumsearch/src/main/webapp/jsp/forgot_password_form.jsp index 54a2d36..58d0aba 100644 --- a/curriculumsearch/src/main/webapp/jsp/forgot_password_form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/forgot_password_form.jsp @@ -9,19 +9,26 @@ - +
+ + + Volver +Te enviaremos el link de recuperación de tu cuenta a tu email
+Te enviaremos el link de recuperacion de tu cuenta a tu email
diff --git a/curriculumsearch/src/main/webapp/jsp/index.jsp b/curriculumsearch/src/main/webapp/jsp/index.jsp
index 553ce4a..dfce6da 100644
--- a/curriculumsearch/src/main/webapp/jsp/index.jsp
+++ b/curriculumsearch/src/main/webapp/jsp/index.jsp
@@ -7,5 +7,14 @@
-
+
- -
-- -
++ +
++ +
+