Commit 8d481fa4 by Joel Florentin

Merge branch 'giuli_001' of https://phoebe.roshka.com/gitlab/hshah/TalentoHumano into joel-001

parents 9a8264d4 787511df
......@@ -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";
}
......
......@@ -8,20 +8,27 @@
<title>Forgot Password</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="https://getbootstrap.com/docs/4.0/examples/signin/signin.css" rel="stylesheet" crossorigin="anonymous">
<link rel="icon" href="/img/LogoRoshka.ico">
<link rel="icon" href="../img/LogoRoshka.ico">
<link href="../css/cargoStyle.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<a type="button" class="btn btn-xl btn-light m-3" href="/login">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
<path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/>
</svg>
Volver
</a>
<jsp:include page="alerts.jsp"/>
<div class="container">
<h2 class="col float-center">Recuperación de Contraseña</h2>
<div class="container mb-3">
<h2 style="text-align: center;">Recuperacion de Password</h2>
</div>
<form:form action="/forgot-password" method="post" style="max-width: 420px; margin: 0 auto;">
<div class="border border-secondary rounded p-3">
<div>
<p>Te enviaremos el link de recuperación de tu cuenta a tu email</p>
<p>Te enviaremos el link de recuperacion de tu cuenta a tu email</p>
</div>
<div>
<p>
......
......@@ -7,5 +7,14 @@
<link href="/css/indexStyle.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="/img/LogoRoshka.ico">
</layout:put>
<layout:put block="contents" type="REPLACE">
<body>
<form:form method="post" action="/generarCodigoRegistro">
<button class="btn btn-outline-light"><strong>Generar clave de Registro:</strong></button> ${clave}
</form:form>
<c:if test="${clave}">
Clave de Registro:
</c:if>
</body>
</layout:put>
</layout:extends>
\ No newline at end of file
......@@ -72,6 +72,22 @@
</div>
</nav>
</header>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLabel">Esta seguro que desea salir?</h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<a href="/logout" class="btn btn-danger">Salir</a>
</div>
</div>
</div>
</div>
<div class="container-xxl my-md-4 bd-layout">
<layout:block name="contents">
......
......@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<link href="../css/cargoStyle.css" rel="stylesheet" type="text/css"/>
</head>
<style>
@media (min-width: 1025px) {
......@@ -18,14 +18,22 @@
}
</style>
<body>
<a type="button" class="btn btn-xl btn-light m-3" href="/login">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
<path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/>
</svg>
Volver
</a>
<section class="h-100 h-custom">
<div class="container py-5 h-100">
<jsp:include page="alerts.jsp"/>
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-lg-8 col-xl-6">
<h3 class="mb-4 pb-2 pb-md-0 mb-md-5 px-md-2" style="text-align: center;">Informacion de Registro</h3>
<div class="card rounded-3">
<img src="https://cdn.pixabay.com/photo/2013/08/09/05/54/layer-170971_960_720.jpg" class="w-100" style="border-top-left-radius: .3rem; border-top-right-radius: .3rem;height: 250px;" alt="Sample photo";>
<div class="card-body p-4 p-md-5">
<h3 class="mb-4 pb-2 pb-md-0 mb-md-5 px-md-2">Informacion de Registro</h3>
<form:form action="/process_register" class="px-md-2" method="POST" modelAttribute="user">
<div class="form-outline mb-4">
......@@ -55,14 +63,14 @@
<div class="col-md-6">
<div class="form-outline">
<input type="text" id="form3Example1w" class="form-control" name="registrationCode" required/>
<label class="form-label" for="form3Example1w">Registration code</label>
<label class="form-label" for="form3Example1w" style="width: 600px">Clave de Registro</label>
<input type="password" id="form3Example1w" class="form-control" name="registrationCode" required/>
</div>
</div>
</div>
<button type="submit" class="btn btn-success btn-lg mb-1">Submit</button>
<button type="submit" class="btn btn-primary btn-lg mb-1">Submit</button>
</form:form>
</div>
......
......@@ -7,16 +7,23 @@
<meta name="author" content="">
<title>Forgot Password</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="https://getbootstrap.com/docs/4.0/examples/signin/signin.css" rel="stylesheet" crossorigin="anonymous">
<link href="../css/cargoStyle.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<jsp:include page="alerts.jsp"/>
<a type="button" class="btn btn-xl btn-light m-3" href="/login">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
<path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/>
</svg>
Volver
</a>
<div class="container">
<h2>Cambia tu contraseña</h2>
</div>
<jsp:include page="alerts.jsp"/>
<div class="m-3">
<h2 style="text-align: center;">Cambia tu password</h2>
</div>
<form:form action="/reset-password" method="post" style="max-width: 350px; margin: 0 auto;">
<form:form action="/reset-password" method="post" style="max-width: 350px; margin: 0 auto;">
<input type="hidden" name="token" value="${token}" />
<div class="border border-secondary rounded p-3">
<div>
......@@ -29,7 +36,8 @@
</p>
</div>
</div>
</form:form>
</form:form>
</div>
</body>
</html>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment