modals olvido contraseña
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -20,7 +20,8 @@
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.41",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"vite": "^5.3.1"
|
||||
"vite": "^5.3.1",
|
||||
"vite-plugin-remove-console": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
@@ -1967,6 +1968,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-remove-console": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-remove-console/-/vite-plugin-remove-console-2.2.0.tgz",
|
||||
"integrity": "sha512-qgjh5pz75MdE9Kzs8J0kBwaCfifHV0ezRbB9rpGsIOxam+ilcGV7WOk91vFJXquzRmiKrFh3Hxlh0JJWAmXTbQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.41",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"vite": "^5.3.1"
|
||||
"vite": "^5.3.1",
|
||||
"vite-plugin-remove-console": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,10 @@
|
||||
<a
|
||||
href="#"
|
||||
class="text-xs text-gray-600 hover:text-indigo-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||
@click="showModal"
|
||||
@click="
|
||||
visibleModalPassword = true;
|
||||
email = '';
|
||||
"
|
||||
>Olvidó la contraseña?</a
|
||||
>
|
||||
</div>
|
||||
@@ -65,7 +68,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal de recuperar contraseña -->
|
||||
<fwb-modal v-if="visibleModalPassword" @close="closeModal">
|
||||
<fwb-modal v-if="visibleModalPassword" @close="visibleModalPassword = false">
|
||||
<template #header>
|
||||
<div class="flex items-center text-lg">Recuperar contraseña</div>
|
||||
</template>
|
||||
@@ -85,7 +88,7 @@
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="flex justify-between">
|
||||
<fwb-button @click="closeModal" color="alternative">
|
||||
<fwb-button @click="visibleModalPassword = false" color="alternative">
|
||||
Decline
|
||||
</fwb-button>
|
||||
<fwb-button @click="requestPasswordReset" color="green">
|
||||
@@ -94,6 +97,30 @@
|
||||
</div>
|
||||
</template>
|
||||
</fwb-modal>
|
||||
<!-- Modal de parametros incorrectos -->
|
||||
<fwb-modal
|
||||
v-if="visibleModalIncorrect"
|
||||
@close="visibleModalIncorrect = false"
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex items-center text-lg text-red-700">Error</div>
|
||||
</template>
|
||||
<template #body> Parametros incorrectos </template>
|
||||
</fwb-modal>
|
||||
<!-- Modal de correo enviado -->
|
||||
<fwb-modal v-if="visibleModalSended" @close="visibleModalSended = false">
|
||||
<template #header>
|
||||
<div class="flex items-center text-lg text-green-700">Aviso</div>
|
||||
</template>
|
||||
<template #body> Correo enviado </template>
|
||||
</fwb-modal>
|
||||
<!-- Modal de correo invalido -->
|
||||
<fwb-modal v-if="visibleModalInvalid" @close="visibleModalInvalid = false">
|
||||
<template #header>
|
||||
<div class="flex items-center text-lg text-red-700">Aviso</div>
|
||||
</template>
|
||||
<template #body> No es un correo válido </template>
|
||||
</fwb-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -110,8 +137,14 @@ let pb = null;
|
||||
let email = ref("p40store@gmail.com");
|
||||
let password = ref("p40store");
|
||||
const visibleModalPassword = ref(false);
|
||||
const visibleModalIncorrect = ref(false);
|
||||
const visibleModalSended = ref(false);
|
||||
const visibleModalInvalid = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
if (pb != null) {
|
||||
pb.authStore.clear();
|
||||
}
|
||||
pb = new PocketBase("http://127.0.0.1:8090");
|
||||
});
|
||||
|
||||
@@ -129,35 +162,27 @@ const login = async () => {
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
alert("Parámetros incorrectos");
|
||||
visibleModalIncorrect.value = true;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Muestra el modal de recuperaci n de contrase a
|
||||
*/
|
||||
const closeModal = () => {
|
||||
visibleModalPassword.value = false;
|
||||
};
|
||||
const showModal = () => {
|
||||
email = ref("");
|
||||
visibleModalPassword.value = true;
|
||||
};
|
||||
|
||||
const requestPasswordReset = async () => {
|
||||
const authData = await pb
|
||||
.collection("users")
|
||||
.requestPasswordReset(email.value)
|
||||
.then(function (result) {
|
||||
closeModal();
|
||||
alert("Correo enviado");
|
||||
visibleModalSended.value = true;
|
||||
})
|
||||
.catch(function () {
|
||||
alert("No existe el correo");
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
visibleModalInvalid.value = true;
|
||||
});
|
||||
visibleModalPassword.value = false;
|
||||
email.value = "";
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.ancho {
|
||||
width: 30%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import removeConsole from "vite-plugin-remove-console";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
],
|
||||
plugins: [vue(), removeConsole()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
}
|
||||
})
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
esbuild: { // disable logs in production?
|
||||
drop: ["console", "debugger"],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user