diff --git a/components/admin/Login.vue b/components/admin/Login.vue index 8353131..f3f5d9b 100644 --- a/components/admin/Login.vue +++ b/components/admin/Login.vue @@ -20,6 +20,10 @@ /> + + + +
{ + this.$alertsGenericos.imprimirError( + this.$buefy, + this.$router, + 'Favor de completar el recaptcha' + ) + }) + + if (this.usuario && this.password && token && !this.error) { const data = { operador: this.usuario, password: this.password, @@ -57,13 +69,16 @@ export default { this.updateIsLoading(true) axios - .post(`${process.env.api}/auth/login-admin`, data) - .then((res) => { + .post(`${process.env.api}/auth/login-admin`, data, { + headers: { recaptcha: token }, + }) + .then(async (res) => { const token = res.data.token const operador = JSON.stringify(res.data.operador) localStorage.setItem('operador', operador) localStorage.setItem('token', token) + await this.$recaptcha.reset() this.updateIsLoading(false) if (res.data.operador.tipoUsuario.id_tipo_usuario === 2) this.$router.push( @@ -91,6 +106,9 @@ export default { if (this.error) this.error = '' }, }, + beforeDestroy() { + this.$recaptcha.destroy() + }, } diff --git a/components/operador/Login.vue b/components/operador/Login.vue index 70c5755..1bbf360 100644 --- a/components/operador/Login.vue +++ b/components/operador/Login.vue @@ -42,7 +42,11 @@ -
+ + + + + Iniciar Sesión -
- - +