mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-18 15:57:31 -03:00
ahora requiere que repitas la contraseña para que te deje enviar
This commit is contained in:
@@ -25,6 +25,10 @@
|
|||||||
let checkeandoEmail: boolean | null = $state(null);
|
let checkeandoEmail: boolean | null = $state(null);
|
||||||
let esEmailValido = $state(false);
|
let esEmailValido = $state(false);
|
||||||
|
|
||||||
|
let dto: RegisterDto = $state({ password: '', username: '', email: '', displayName: '' });
|
||||||
|
|
||||||
|
let coinsidenLasPass = $derived(repetirContraseña == dto.password);
|
||||||
|
|
||||||
async function checkUsuario() {
|
async function checkUsuario() {
|
||||||
checkeandoUsuario = true;
|
checkeandoUsuario = true;
|
||||||
esUsuarioValido = await checkUsername(dto.username);
|
esUsuarioValido = await checkUsername(dto.username);
|
||||||
@@ -38,11 +42,9 @@
|
|||||||
}
|
}
|
||||||
const setAlert = () => (showAlert = true);
|
const setAlert = () => (showAlert = true);
|
||||||
|
|
||||||
let dto: RegisterDto = $state({ password: '', username: '', email: '', displayName: '' });
|
|
||||||
|
|
||||||
const handleSubmit = async (e: SubmitEvent) => {
|
const handleSubmit = async (e: SubmitEvent) => {
|
||||||
if (esUsuarioValido == false) return;
|
if (esUsuarioValido == false) return;
|
||||||
if (repetirContraseña !== dto.password) return;
|
if (!coinsidenLasPass) return;
|
||||||
|
|
||||||
cargando = true;
|
cargando = true;
|
||||||
await register(e, dto, setAlert);
|
await register(e, dto, setAlert);
|
||||||
@@ -115,12 +117,18 @@
|
|||||||
</Field.Field>
|
</Field.Field>
|
||||||
<Field.Field>
|
<Field.Field>
|
||||||
<Field.Label for="confirm-password">Confirmar Contraseña</Field.Label>
|
<Field.Label for="confirm-password">Confirmar Contraseña</Field.Label>
|
||||||
<Input id="confirm-password" type="password" required bind:value={repetirContraseña} />
|
<Input
|
||||||
|
id="confirm-password"
|
||||||
|
type="password"
|
||||||
|
required
|
||||||
|
bind:value={repetirContraseña}
|
||||||
|
class={{ 'border-red-500': !coinsidenLasPass }}
|
||||||
|
/>
|
||||||
<Field.Description>Confirma la contraseña</Field.Description>
|
<Field.Description>Confirma la contraseña</Field.Description>
|
||||||
</Field.Field>
|
</Field.Field>
|
||||||
<Field.Group>
|
<Field.Group>
|
||||||
<Field.Field>
|
<Field.Field>
|
||||||
<Button type="submit" disabled={cargando}>
|
<Button type="submit" disabled={cargando || !coinsidenLasPass}>
|
||||||
{#if cargando}
|
{#if cargando}
|
||||||
Creando Cuenta...
|
Creando Cuenta...
|
||||||
<Loader2Icon class="animate-spin" />
|
<Loader2Icon class="animate-spin" />
|
||||||
|
|||||||
Reference in New Issue
Block a user