feat(users): reemplazar confirmación por envío de credenciales con link de reset
- Eliminar envío automático de confirmación al crear usuario - Nuevo botón en cada fila: enviar credenciales (usuario + link establecer contraseña) - POST /app/users/:id/credenciales → SendUserCredencialesEmail - Email incluye username, link al login y link para establecer contraseña Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
bf3cbd3606
commit
107178aa97
+20
-25
@@ -82,16 +82,15 @@
|
||||
<!-- Círculo verde -->
|
||||
|
||||
</template>
|
||||
<template x-if="!user.email_verified">
|
||||
<!-- Botón Enviar verificación -->
|
||||
<button @click="enviarVerificación(user.ID)" title="Reenviar validación">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" class="w-5 text-orange-400">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5" />
|
||||
</svg>
|
||||
</button>
|
||||
</template>
|
||||
<!-- Botón Enviar credenciales -->
|
||||
<button @click="enviarCredenciales(user.ID, user.email)" title="Enviar credenciales por email"
|
||||
x-show="user.email">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" class="w-5 text-blue-500">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75" />
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
<td class="py-3 text-xs px-4 border-b flex justify-between space-x-1">
|
||||
<!-- Botón de Ver -->
|
||||
@@ -547,22 +546,18 @@
|
||||
});
|
||||
},
|
||||
|
||||
enviarVerificación($id) {
|
||||
this.Id = $id;
|
||||
async enviarCredenciales($id, $email) {
|
||||
if (!confirm(`¿Enviar credenciales de acceso a ${$email}?`)) return;
|
||||
this.loading = true;
|
||||
fetch(`/app/verificacion/${this.Id}`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
.then(() => {
|
||||
alert('Se ha enviado un correo de verificación');
|
||||
this.closeModal();
|
||||
this.loadRegister();
|
||||
})
|
||||
.catch(error => console.error('Error:', error))
|
||||
.finally(() => {
|
||||
this.loading = false; // Ocultar el GIF de carga
|
||||
});
|
||||
try {
|
||||
const r = await fetch(`/app/users/${$id}/credenciales`, { method: 'POST' });
|
||||
const data = await r.json();
|
||||
alert(data.message || 'Credenciales enviadas');
|
||||
} catch (e) {
|
||||
alert('Error al enviar credenciales');
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user