trabajando en el signup. problema con el mismo username aunque este delete at

This commit is contained in:
2025-10-03 18:30:26 +02:00
parent cc49732531
commit d9c4f16cf0
11 changed files with 309 additions and 107 deletions

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="es" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title th:text="${subject} ?: 'Notificación'">Notificación</title>
<link rel="stylesheet" th:href="@{/css/email.css}">
</head>
<body>
<table role="presentation" class="email-wrapper">
<tr>
<td align="center" class="email-body">
<table role="presentation" class="email-container">
<!-- Header -->
<tr>
<td class="email-header">
<h2>
<img src="/assets/images/logo-light.png" alt="" height="45">
</h2>
</td>
</tr>
<!-- Content (fragmento) -->
<tr>
<td class="email-content">
<div th:replace="~{::bodyContent}"></div>
</td>
</tr>
<!-- Footer -->
<tr>
<td class="email-footer">
<p>
<strong th:text="${companyName} ?: 'ImprimeLibros'">ImprimeLibros</strong><br>
Calle José Picón, Nº 28 Local A, 28028, Madrid<br>
91 005 25 74 -
<a href="mailto:contacto@imprimelibros.com" style="color:#2563eb;">
contacto@imprimelibros.com
</a><br>
&copy; <span th:text="${year} ?: ${#dates.year(#dates.createNow())}">2025</span>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="es" xmlns:th="http://www.thymeleaf.org" th:replace="emails/layout :: bodyContent">
<body>
<p><span th:text="#{email.greeting}">Hola</span> <span th:text="${fullName}">usuario</span>,</p>
<p><span th:text="#{email.verify.body}">Haz clic en el siguiente botón para verificar tu correo electrónico:</span>
</p>
<p>
<a th:href="${verifyUrl}" class="btn btn-secondary" target="_blank">
<span th:text="#{email.verify.button}">Verificar cuenta</span>
</a>
</p>
<p><span th:text="#{email.verify.link-instruction}">Si no funciona, copia y pega esta URL en tu navegador:</span>
</p>
<p><span th:text="${verifyUrl}">https://...</span></p>
<p><span th:text="#{email.verify.expiration(${minutes} ?: 60)}">Este enlace caduca en 60 minutos.</span></p>
<p><span th:text="#{email.verify.ignoreMessage}">Si no solicitaste este cambio, puedes ignorar este mensaje.</span>
</p>
</body>
</html>

View File

@ -1,53 +1,56 @@
<div th:fragment="_signup">
<div class="p-lg-5 p-4">
<div>
<h5 class="text-primary" th:text="#{login.welcome}">¡Bienvenido!</h5>
<p class="text-muted" th:text="#{login.signup-subtitle}">Regístrate para continuar:</p>
<p class="text-muted" th:text="#{login.sign-up.title}">Crear cuenta</p>
</div>
<div class="mt-4">
<form th:action="@{/signup}" method="post">
<!-- CSRF obligatorio -->
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
<div th:if="${info}" class="alert alert-info" th:text="${info}"></div>
<div th:if="${danger}" class="alert alert-danger" th:text="${danger}"></div>
<div th:if="${signup_error}" class="alert alert-danger" th:text="${signup_error}"></div>
<div th:if="${param.error}" class="alert alert-danger"
th:text="#{login.error}">
Credenciales inválidas
<!-- En el caso del formulario de signup, asegúrate de bindear el DTO -->
<form th:if="${form == '_signup'}" th:action="@{/signup}" method="post" th:object="${signupForm}">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
<div class="mb-3">
<label for="username" class="form-label" th:text="#{login.email}">Correo electrónico</label>
<input type="email" class="form-control" id="username" th:field="*{username}"
th:placeholder="#{login.email-placeholder}">
<div class="text-danger" th:if="${#fields.hasErrors('username')}" th:errors="*{username}"></div>
</div>
<div class="mb-3">
<label class="form-label" for="name" th:text="#{login.sign-up.name}">Nombre completo</label>
<input type="text" class="form-control" id="name" th:field="*{name}"
th:placeholder="#{login.sign-up.name}">
<div class="text-danger" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></div>
</div>
<div class="mb-3">
<label class="form-label" for="password-input" th:text="#{login.password}">Contraseña</label>
<input type="password" class="form-control" id="password-input" th:field="*{password}"
th:placeholder="#{login.password-placeholder}">
<div class="text-danger" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></div>
</div>
<div class="mb-3">
<label class="form-label" for="password-confirm-input" th:text="#{login.confirm-password}">Confirmar
contraseña</label>
<input type="password" class="form-control" id="password-confirm-input" th:field="*{passwordConfirm}"
th:placeholder="#{login.password-placeholder}">
<div class="text-danger" th:if="${#fields.hasErrors('passwordConfirm')}" th:errors="*{passwordConfirm}">
</div>
</div>
<div class="mb-3">
<label for="username" class="form-label" th:text="#{login.email}">Correo electrónico</label>
<input type="email" class="form-control" id="username" th:placeholder="#{login.email-placeholder}"
name="username">
</div>
<div class="mb-3">
<label class="form-label" for="password-input" th:text="#{login.password}">Contraseña</label>
<div class="position-relative auth-pass-inputgroup mb-3">
<input type="password" class="form-control pe-5 password-input"
th:placeholder="#{login.password-placeholder}" id="password-input" name="password">
<button
class="btn btn-link position-absolute end-0 top-0 text-decoration-none text-muted password-addon"
type="button" id="password-addon"><i class="ri-eye-fill align-middle"></i></button>
</div>
</div>
<div class="mb-3">
<label class="form-label" for="password-confirm-input" th:text="#{login.confirm-password}">Confirmar contraseña</label>
<div class="position-relative auth-pass-inputgroup mb-3">
<input type="password" class="form-control pe-5 password-input"
th:placeholder="#{login.password-placeholder}" id="password-confirm-input" name="password-confirm">
<button
class="btn btn-link position-absolute end-0 top-0 text-decoration-none text-muted password-addon"
type="button" id="password-addon"><i class="ri-eye-fill align-middle"></i></button>
</div>
</div>
<div class="mt-4">
<button class="btn btn-secondary w-100" type="submit" th:text="#{login.sign-up-button}">Crear cuenta</button>
</div>
</form>
</div>
<div class="mt-4">
<button class="btn btn-secondary w-100" type="submit" th:text="#{login.sign-up-button}">Crear
cuenta</button>
</div>
</form>
</div>
</div>