fix(auth/users): corregir edicion de contraseñas de usuarios, cambio de contraseña y evitar pantalla en blanco
This commit is contained in:
@@ -433,6 +433,84 @@ app.get('/:blueprint/:route', (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
// Middleware 404 para cualquier ruta no encontrada (evita pantallas en blanco y errores Cannot POST/GET)
|
||||
app.use((req, res) => {
|
||||
res.status(404).send(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Página No Encontrada — Edu-Space</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<style>
|
||||
body { background: #0f172a; color: #f8fafc; font-family: system-ui, -apple-system, sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; margin: 0; }
|
||||
.card-error { background: #1e293b; border: 1px solid #334155; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container text-center p-4" style="max-width: 520px;">
|
||||
<div class="card card-error p-4 p-md-5">
|
||||
<div class="mb-3 text-warning">
|
||||
<i class="bi bi-compass fs-1"></i>
|
||||
</div>
|
||||
<h1 class="h3 fw-bold mb-2">Página o Acción No Encontrada</h1>
|
||||
<p class="text-secondary small mb-4">
|
||||
La ruta solicitada <code class="text-light">${req.originalUrl}</code> no existe o no admite el método HTTP ejecutado.
|
||||
</p>
|
||||
<div class="d-flex justify-content-center gap-2">
|
||||
<a href="/dashboard" class="btn btn-primary px-4 fw-semibold">
|
||||
<i class="bi bi-house-door me-1"></i>Volver al Panel
|
||||
</a>
|
||||
<button onclick="window.history.back()" class="btn btn-outline-light px-4">
|
||||
Volver Atrás
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
});
|
||||
|
||||
// Middleware Global de Error 500
|
||||
app.use((err, req, res, next) => {
|
||||
console.error('Error no capturado en BFF:', err);
|
||||
res.status(500).send(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Error del Sistema — Edu-Space</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<style>
|
||||
body { background: #0f172a; color: #f8fafc; font-family: system-ui, -apple-system, sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; margin: 0; }
|
||||
.card-error { background: #1e293b; border: 1px solid #334155; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container text-center p-4" style="max-width: 520px;">
|
||||
<div class="card card-error p-4 p-md-5">
|
||||
<div class="mb-3 text-danger">
|
||||
<i class="bi bi-exclamation-triangle-fill fs-1"></i>
|
||||
</div>
|
||||
<h1 class="h3 fw-bold mb-2">Error en la Aplicación</h1>
|
||||
<p class="text-secondary small mb-4">
|
||||
Ocurrió una eventualidad procesando la solicitud. Nuestro equipo técnico ha sido notificado.
|
||||
</p>
|
||||
<a href="/dashboard" class="btn btn-primary px-4 fw-semibold">
|
||||
<i class="bi bi-house-door me-1"></i>Volver al Panel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`BFF Frontend corriendo en http://localhost:${port}`);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user