Added service plan. Password change
This commit is contained in:
@@ -3,20 +3,7 @@
|
||||
<template>
|
||||
<div class="WrapperPlain">
|
||||
<div class="container max-w-3xl mx-auto text-white">
|
||||
<div class="mt-5 mb-5 px-10 ">
|
||||
<nav class="rounded-md w-full">
|
||||
<ol class="list-reset flex">
|
||||
<li>
|
||||
<router-link :to="{ name: 'home' }">
|
||||
<a class="text-primary hover:text-primary ">Home</a>
|
||||
</router-link>
|
||||
</li>
|
||||
<li>
|
||||
<span class="text-gray-500 mx-2">/</span>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="mx-auto max-w-lg flex items-center justify-center mb-10 mt-20 px-5">
|
||||
<form class="bg-neutral rounded-md px-8 pt-6 pb-8 mb-4 w-full" @submit.prevent="onSubmit">
|
||||
<div class="mb-4 text-center text-[28px] ">
|
||||
@@ -56,7 +43,7 @@ import { defineComponent } from "vue";
|
||||
import axios from "axios";
|
||||
import { notify } from "@kyvg/vue3-notification";
|
||||
import useValidate from "@vuelidate/core";
|
||||
import { required, minLength } from "@vuelidate/validators";
|
||||
import { required, minLength, helpers } from "@vuelidate/validators";
|
||||
import Header from "../../layouts/headers/headerauth.vue";
|
||||
import authHeader from "../../services/auth.header";
|
||||
|
||||
@@ -82,7 +69,7 @@ export default defineComponent({
|
||||
return {
|
||||
ChangePasswordForm: {
|
||||
new_password: { required, minLength: minLength(6) },
|
||||
password_confirm: { required, minLength: minLength(6) },
|
||||
password_confirm: { required, minLength: minLength(6), sameAsPassword: helpers.withMessage('Passwords must match', (value: string) => value === this.ChangePasswordForm.new_password) },
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -118,13 +105,14 @@ export default defineComponent({
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
}).then((response:any) => {
|
||||
console.log(response)
|
||||
if (response.data.ok) {
|
||||
notify({
|
||||
title: "Authorization",
|
||||
text: "Success!",
|
||||
text: "Password changed",
|
||||
type: "success",
|
||||
});
|
||||
this.$router.push({ name: "login" });
|
||||
this.$router.push({ name: "home" });
|
||||
}
|
||||
if (response.data.error) {
|
||||
notify({
|
||||
@@ -149,6 +137,7 @@ export default defineComponent({
|
||||
new_password: this.ChangePasswordForm.new_password,
|
||||
password_confirm: this.ChangePasswordForm.password_confirm,
|
||||
};
|
||||
|
||||
this.v$.$validate(); // checks all inputs
|
||||
if (this.v$.$invalid) {
|
||||
notify({
|
||||
@@ -163,4 +152,4 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user