add: view change password & email
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
import { useCompanyStore } from '../stores/company';
|
import { useCompanyStore } from '../stores/company';
|
||||||
import { useAuthStore } from '../stores/auth';
|
import { useAuthStore } from '../stores/auth';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
location: {
|
location: {
|
||||||
|
|||||||
114
src/components/FormChangeEmail.vue
Normal file
114
src/components/FormChangeEmail.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<script setup>
|
||||||
|
import {reactive, ref} from 'vue';
|
||||||
|
import CustomInput from './ui/CustomInput.vue';
|
||||||
|
import Spiner from './ui/Spiner.vue';
|
||||||
|
import NotificationBadge from './ui/NotificationBadge.vue';
|
||||||
|
const emailForm = reactive({
|
||||||
|
email: '',
|
||||||
|
email2: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const msgError = ref('');
|
||||||
|
const msgSuccess = ref('');
|
||||||
|
|
||||||
|
const hangleSave = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<form
|
||||||
|
@submit.prevent="hangleSave"
|
||||||
|
autocomplete="off"
|
||||||
|
method="post"
|
||||||
|
ref="formRef1"
|
||||||
|
>
|
||||||
|
<br/>
|
||||||
|
<h3 class="title">Cambiar correo electrónico</h3>
|
||||||
|
<br/>
|
||||||
|
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
|
||||||
|
<NotificationBadge :msg="msgSuccess" v-if="msgSuccess != ''" :is-error="false"/>
|
||||||
|
<CustomInput
|
||||||
|
label=" Nuevo Correo electrónico*:"
|
||||||
|
type="email"
|
||||||
|
name="email"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="emailForm.email"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Confirmar Correo electrónico*:"
|
||||||
|
type="email"
|
||||||
|
name="email2"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="emailForm.email2"
|
||||||
|
/>
|
||||||
|
<div class="warning-info">
|
||||||
|
<div><i class="fa-solid fa-triangle-exclamation warning"></i></div> Esta acción cambiara su correo electrónico, se le enviara un código al correo proporcionado lo cual deberas colocarlo para confirmar la acción, una vez confirmada la accion, se cerrara su sesión y debera volver a iniciar sesión con su nuevo correo.
|
||||||
|
</div>
|
||||||
|
<div class="mt-5 text-center">
|
||||||
|
<Spiner v-if="loading"/>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-dark btn-block" type="submit">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* .box-back-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 16px 0px;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.warning-info {
|
||||||
|
display: flex;
|
||||||
|
padding: 16px;
|
||||||
|
background: rgb(223, 223, 161);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
justify-items: center;
|
||||||
|
align-items: center;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgb(86, 57, 57);
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
font-size: 33px;
|
||||||
|
margin-right: 12px;
|
||||||
|
/* color: white; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-block {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 16px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 32px 32px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 568px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 8px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 20px 20px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-phone{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
144
src/components/FormChangePassword.vue
Normal file
144
src/components/FormChangePassword.vue
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<script setup>
|
||||||
|
import {reactive, ref} from 'vue';
|
||||||
|
import CustomInput from './ui/CustomInput.vue';
|
||||||
|
import Spiner from './ui/Spiner.vue';
|
||||||
|
import NotificationBadge from './ui/NotificationBadge.vue';
|
||||||
|
const pwdForm = reactive({
|
||||||
|
pwd: '',
|
||||||
|
pwd2: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const msgError = ref('');
|
||||||
|
const msgSuccess = ref('');
|
||||||
|
|
||||||
|
const hangleSave = () => {
|
||||||
|
msgError.value = '';
|
||||||
|
msgSuccess.value = '';
|
||||||
|
let resp = validations();
|
||||||
|
if(resp !== '') {
|
||||||
|
msgError.value = resp;
|
||||||
|
clearMessages();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const validations = () => {
|
||||||
|
const pass = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/;
|
||||||
|
|
||||||
|
if(!pass.test(pwdForm.pwd)) {
|
||||||
|
return 'Contraseña poco segura';
|
||||||
|
} else if (pwdForm.pwd !== pwdForm.pwd2) {
|
||||||
|
return 'Las contraseñas no coinciden';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearMessages = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
msgError.value = '';
|
||||||
|
msgSuccess.value = '';
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<form
|
||||||
|
@submit.prevent="hangleSave"
|
||||||
|
autocomplete="off"
|
||||||
|
method="post"
|
||||||
|
ref="formRef1"
|
||||||
|
>
|
||||||
|
<br/>
|
||||||
|
<h3 class="title">Cambiar contraseña</h3>
|
||||||
|
<br/>
|
||||||
|
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
|
||||||
|
<NotificationBadge :msg="msgSuccess" v-if="msgSuccess != ''" :is-error="false"/>
|
||||||
|
<CustomInput
|
||||||
|
label=" Nueva contraseña*:"
|
||||||
|
type="password"
|
||||||
|
name="pwd"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="pwdForm.pwd"
|
||||||
|
help-text="La Contraseña debe ser mínimo 8 caracteres, al menos una mayúscula, al menos una minúscula, y un digito."
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Confirme contraseña*:"
|
||||||
|
type="password"
|
||||||
|
name="pwd2"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="pwdForm.pwd2"
|
||||||
|
/>
|
||||||
|
<div class="warning-info">
|
||||||
|
<div><i class="fa-solid fa-triangle-exclamation warning"></i></div>
|
||||||
|
Esta acción cerrara su sesión actual y debera volver a iniciar sesión con su nueva contraseña
|
||||||
|
</div>
|
||||||
|
<div class="mt-5 text-center">
|
||||||
|
<Spiner v-if="loading"/>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-dark btn-block" type="submit">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* .box-back-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 16px 0px;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.warning-info {
|
||||||
|
display: flex;
|
||||||
|
padding: 16px;
|
||||||
|
background: rgb(223, 223, 161);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
justify-items: center;
|
||||||
|
align-items: center;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgb(86, 57, 57);
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
font-size: 33px;
|
||||||
|
margin-right: 12px;
|
||||||
|
/* color: white; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-block {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 16px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 32px 32px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 568px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 8px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 20px 20px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-phone{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -17,7 +17,7 @@ import Pagination from '../components/Pagination.vue';
|
|||||||
const selectedCities = ref([]);
|
const selectedCities = ref([]);
|
||||||
const filterQuery = ref([]);
|
const filterQuery = ref([]);
|
||||||
|
|
||||||
const limit = 5;
|
const limit = 10;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
filterQuery.value.company_type = 'carrier';
|
filterQuery.value.company_type = 'carrier';
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
import CustomInput from '../components/ui/CustomInput.vue';
|
import CustomInput from '../components/ui/CustomInput.vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import NotificationBadge from '../components/ui/NotificationBadge.vue';
|
import NotificationBadge from '../components/ui/NotificationBadge.vue';
|
||||||
|
import FormChangePassword from '../components/FormChangePassword.vue';
|
||||||
|
import FormChangeEmail from '../components/FormChangeEmail.vue';
|
||||||
|
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
|
|
||||||
@@ -13,6 +15,7 @@
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const msgError = ref('');
|
const msgError = ref('');
|
||||||
const msgSuccess = ref('');
|
const msgSuccess = ref('');
|
||||||
|
const form = ref(0);
|
||||||
|
|
||||||
const userForm = reactive({
|
const userForm = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
@@ -36,6 +39,7 @@
|
|||||||
userForm.name = user.value?.first_name
|
userForm.name = user.value?.first_name
|
||||||
userForm.lastName = user.value?.last_name
|
userForm.lastName = user.value?.last_name
|
||||||
userForm.phone1 = user.value?.phone
|
userForm.phone1 = user.value?.phone
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async() => {
|
const handleSave = async() => {
|
||||||
@@ -82,18 +86,38 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setForm = (val) => {
|
||||||
|
form.value = val
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
<div class="box-btns">
|
<div class="box-btns">
|
||||||
<a class="btn-text" type="submit">Cambiar contraseña</a>
|
<a class="btn-text"
|
||||||
<a class="btn-text" type="submit">Cambiar correo</a>
|
:class="[(form === 0) ? 'selection' : '']"
|
||||||
|
@click="setForm(0)"
|
||||||
|
>Datos usuario</a>
|
||||||
|
<a class="btn-text"
|
||||||
|
:class="[(form === 1) ? 'selection' : '']"
|
||||||
|
@click="setForm(1)"
|
||||||
|
>Cambiar correo</a>
|
||||||
|
<a class="btn-text"
|
||||||
|
:class="[(form === 2) ? 'selection' : '']"
|
||||||
|
@click="setForm(2)"
|
||||||
|
>Cambiar contraseña</a>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
<form
|
||||||
|
@submit.prevent="handleSave"
|
||||||
|
autocomplete="off"
|
||||||
|
method="post"
|
||||||
|
ref="formRef"
|
||||||
|
v-if="form === 0"
|
||||||
|
>
|
||||||
<br/>
|
<br/>
|
||||||
<form @submit.prevent="handleSave" autocomplete="off" method="post" ref="formRef">
|
|
||||||
<h3 class="title">Datos de usuario</h3>
|
<h3 class="title">Datos de usuario</h3>
|
||||||
<br/>
|
<br/>
|
||||||
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
|
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
|
||||||
@@ -120,13 +144,15 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
v-model:field="userForm.phone1"
|
v-model:field="userForm.phone1"
|
||||||
/>
|
/>
|
||||||
<div class="mt-4 text-center">
|
<div class="mt-5 text-center">
|
||||||
<Spiner v-if="loading"/>
|
<Spiner v-if="loading"/>
|
||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
class="btn btn-dark btn-block" type="submit">Guardar</button>
|
class="btn btn-dark btn-block" type="submit">Guardar</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<FormChangeEmail v-if="form === 1"/>
|
||||||
|
<FormChangePassword v-if="form === 2"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -135,11 +161,16 @@
|
|||||||
/* .profile {
|
/* .profile {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
.box-btns {
|
.box-btns {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selection {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
.form-content {
|
.form-content {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
max-width: 768px;
|
max-width: 768px;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const query = ref('');
|
const query = ref('');
|
||||||
const filterQuery = ref([]);
|
const filterQuery = ref([]);
|
||||||
const limit = 5;
|
const limit = 10;
|
||||||
|
|
||||||
onMounted(() =>{
|
onMounted(() =>{
|
||||||
console.log('init')
|
console.log('init')
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
getInitData();
|
getInitData();
|
||||||
})
|
})
|
||||||
|
|
||||||
const limit = 5;
|
const limit = 10;
|
||||||
|
|
||||||
const getInitData = async() => {
|
const getInitData = async() => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
const selectedCities = ref([]);
|
const selectedCities = ref([]);
|
||||||
const filterQuery = ref([]);
|
const filterQuery = ref([]);
|
||||||
|
|
||||||
const limit = 5;
|
const limit = 10;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
filterQuery.value.company_type = 'shipper';
|
filterQuery.value.company_type = 'shipper';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
const proposalCurrent = ref(null);
|
const proposalCurrent = ref(null);
|
||||||
const openModal = ref(false);
|
const openModal = ref(false);
|
||||||
const openModalProposal = ref(false);
|
const openModalProposal = ref(false);
|
||||||
const limit = 5;
|
const limit = 10;
|
||||||
|
|
||||||
onMounted(() =>{
|
onMounted(() =>{
|
||||||
getInitData();
|
getInitData();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { useAuthStore } from '../stores/auth';
|
|||||||
|
|
||||||
const currentUser = ref(null);
|
const currentUser = ref(null);
|
||||||
const openModal = ref(false);
|
const openModal = ref(false);
|
||||||
const limit = 3;
|
const limit = 10;
|
||||||
|
|
||||||
const getInitData = async() => {
|
const getInitData = async() => {
|
||||||
console.log('callll')
|
console.log('callll')
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
const editStatusVehicle = ref(false);
|
const editStatusVehicle = ref(false);
|
||||||
const editDriverVehicle = ref(false);
|
const editDriverVehicle = ref(false);
|
||||||
|
|
||||||
const limit = 3;
|
const limit = 10;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getInitData();
|
getInitData();
|
||||||
|
|||||||
Reference in New Issue
Block a user