<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org"
th:replace="~{layout/auth :: html(pageTitle='Регистрация', content=~{::content}, scripts=~{::scripts})}">
<body>
<th:block th:fragment="content">
<div class="auth-title">
<h2>Завершите регистрацию</h2>
<p>Создайте пароль для входа в систему</p>
</div>
<div class="auth-info">
<div class="info-label">Ваш аккаунт</div>
<p><strong th:text="${parentName}">Имя Фамилия</strong></p>
<p class="mb-0 text-muted" th:text="${parentEmail}">email@example.com</p>
</div>
<form class="auth-form" method="post" th:action="@{/auth/parent/invite}" th:object="${request}">
<input type="hidden" th:field="*{token}">
<div class="mb-3">
<label for="password" class="form-label">Придумайте пароль</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
<input type="password"
class="form-control"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
id="password"
th:field="*{password}"
placeholder="Минимум 6 символов"
required>
<button type="button" class="btn btn-outline-secondary password-toggle" onclick="togglePassword('password')">
<i class="bi bi-eye" id="password-icon"></i>
</button>
</div>
<div class="invalid-feedback d-block" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></div>
</div>
<div class="mb-4">
<label for="confirmPassword" class="form-label">Подтвердите пароль</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock-fill"></i></span>
<input type="password"
class="form-control"
th:classappend="${#fields.hasErrors('confirmPassword')} ? 'is-invalid'"
id="confirmPassword"
th:field="*{confirmPassword}"
placeholder="Повторите пароль"
required>
<button type="button" class="btn btn-outline-secondary password-toggle" onclick="togglePassword('confirmPassword')">
<i class="bi bi-eye" id="confirmPassword-icon"></i>
</button>
</div>
<div class="invalid-feedback d-block" th:if="${#fields.hasErrors('confirmPassword')}" th:errors="*{confirmPassword}"></div>
</div>
<button type="submit" class="btn btn-auth">
<i class="bi bi-check-circle"></i>
Завершить регистрацию
</button>
</form>
</th:block>
<th:block th:fragment="scripts">
<script>
function togglePassword(inputId) {
const input = document.getElementById(inputId);
const icon = document.getElementById(inputId + '-icon');
if (input.type === 'password') {
input.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
input.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
}
</script>
</th:block>
</body>
</html>