VanguardAI/app/Views/auth/register.php
2024-10-27 12:50:51 -06:00

222 lines
6.8 KiB
PHP

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registrarse</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900&display=swap"
rel="stylesheet">
<style>
/* Estilos comunes */
body, html {
height: 100%;
font-family: 'Poppins', sans-serif;
background-color: #f8f9fa;
margin: 0;
}
.container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.card {
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 2rem;
background-color: #ffffff;
}
.form-control {
border-radius: 8px;
}
.btn-primary {
border-radius: 8px;
transition: background-color 0.3s ease, transform 0.3s ease;
}
.btn-primary:hover {
transform: scale(1.02);
}
.text-muted a {
color: #007bff;
text-decoration: none;
transition: color 0.3s ease;
}
.text-muted a:hover {
text-decoration: underline;
color: #0056b3;
}
.text-center {
text-align: center;
}
.fw-bold {
font-weight: 600;
}
/* Ajustes para pantallas pequeñas */
@media (max-width: 576px) {
.card {
padding: 1.5rem;
border-radius: 8px;
}
.btn-primary {
font-size: 0.95rem;
}
.text-muted a {
font-size: 0.9rem;
}
}
/* Ajustes para pantallas medianas */
@media (min-width: 768px) and (max-width: 992px) {
.card {
padding: 2.5rem;
}
.btn-primary {
font-size: 1rem;
}
.text-muted a {
font-size: 1rem;
}
}
/* Ajustes para pantallas grandes */
@media (min-width: 992px) {
.card {
padding: 3rem;
}
.btn-primary {
font-size: 1.1rem;
}
.text-muted a {
font-size: 1rem;
}
}
</style>
</head>
<body class="bg-light">
<div class="container">
<div class="col-md-6">
<div class="card p-4">
<h3 class="text-center fw-bold mb-4">Nuevo Usuario</h3>
<form action="/register" method="POST" novalidate>
<div class="mb-3">
<label for="username" class="form-label">Nombre de Usuario</label>
<input type="text" class="form-control <?php echo isset(
$errors["username"]
)
? "is-invalid"
: ""; ?>" id="username" name="username" value="<?php echo htmlspecialchars(
$old["username"] ?? "",
ENT_QUOTES,
"UTF-8"
); ?>" required>
<?php if (isset($errors["username"])): ?>
<div class="invalid-feedback">
<?php echo htmlspecialchars(
$errors["username"],
ENT_QUOTES,
"UTF-8"
); ?>
</div>
<?php endif; ?>
</div>
<div class="mb-3">
<label for="email" class="form-label">Correo Electrónico</label>
<input type="email" class="form-control <?php echo isset(
$errors["email"]
)
? "is-invalid"
: ""; ?>" id="email" name="email" value="<?php echo htmlspecialchars(
$old["email"] ?? "",
ENT_QUOTES,
"UTF-8"
); ?>" required>
<?php if (isset($errors["email"])): ?>
<div class="invalid-feedback">
<?php echo htmlspecialchars(
$errors["email"],
ENT_QUOTES,
"UTF-8"
); ?>
</div>
<?php endif; ?>
</div>
<div class="mb-3">
<label for="password" class="form-label">Contraseña</label>
<input type="password" class="form-control <?php echo isset(
$errors["password"]
)
? "is-invalid"
: ""; ?>" id="password" name="password" required>
<?php if (isset($errors["password"])): ?>
<div class="invalid-feedback">
<?php echo htmlspecialchars(
$errors["password"],
ENT_QUOTES,
"UTF-8"
); ?>
</div>
<?php endif; ?>
</div>
<button type="submit" class="btn btn-primary w-100">Registrarse</button>
</form>
<p class="mt-3 text-center text-muted">¿Ya tienes una cuenta? <a href="/login">Iniciar Sesión</a></p>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<?php if (isset($success)): ?>
<script>
Swal.fire({
icon: 'success',
title: '¡Registro Exitoso!',
text: '<?php echo htmlspecialchars(
$success,
ENT_QUOTES,
"UTF-8"
); ?>',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Aceptar'
}).then(() => {
window.location.href = "/login";
});
</script>
<?php endif; ?>
<?php if (isset($error)): ?>
<script>
Swal.fire({
icon: 'error',
title: 'Error',
text: '<?php echo htmlspecialchars(
$error,
ENT_QUOTES,
"UTF-8"
); ?>',
confirmButtonColor: '#d33',
confirmButtonText: 'Aceptar'
});
</script>
<?php endif; ?>
</body>
</html>