diff --git a/src/components/common/VnChangePassword.vue b/src/components/common/VnChangePassword.vue index 18f538fc3..79784f3c5 100644 --- a/src/components/common/VnChangePassword.vue +++ b/src/components/common/VnChangePassword.vue @@ -6,7 +6,10 @@ import VnInput from './VnInput.vue'; import FetchData from '../FetchData.vue'; import useNotify from 'src/composables/useNotify'; -const props = defineProps({ submitFn: { type: Function, default: () => {} } }); +const props = defineProps({ + submitFn: { type: Function, default: () => {} }, + askOldPass: { type: Boolean, default: false }, +}); const emit = defineEmits(['onSubmit']); const { t } = useI18n(); const { notify } = useNotify(); @@ -18,8 +21,7 @@ const requirements = ref([]); const isLoading = ref(false); const validate = async () => { - const { newPassword, repeatPassword } = passwords.value; - console.log('Validating passwords:', newPassword, repeatPassword); + const { newPassword, repeatPassword, oldPassword } = passwords.value; if (!newPassword) { notify(t('You must enter a new password'), 'negative'); @@ -29,17 +31,14 @@ const validate = async () => { notify(t("Passwords don't match"), 'negative'); return; } + try { isLoading.value = true; - console.log('Calling submitFn with:', newPassword); - - await props.submitFn(newPassword); + await props.submitFn(newPassword, oldPassword); emit('onSubmit'); } catch (e) { - console.error('submitFn failed:', e); notify('errors.writeRequest', 'negative'); } finally { - console.log('Entering finally block'); changePassDialog.value.hide(); isLoading.value = false; } @@ -58,7 +57,7 @@ defineExpose({ show: () => changePassDialog.value.show() }); - + changePassDialog.value.show() }); + changePassDialog.value.show() }); es: - Change password: Cambiar contraseña New password: Nueva contraseña Repeat password: Repetir contraseña You must enter a new password: Debes introducir la nueva contraseña diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 4c559dfdf..b76c147cd 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -300,6 +300,7 @@ globals: from: From To: To stateFk: State + changePass: Change password errors: statusUnauthorized: Access denied statusInternalServerError: An internal server error has ocurred diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 7cb17aad3..d0d5bdc0d 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -304,6 +304,7 @@ globals: from: Desde To: Hasta stateFk: Estado + changePass: Cambiar contraseña errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue index 0e35d25f3..6f1d2ca1f 100644 --- a/src/pages/Account/Card/AccountDescriptorMenu.vue +++ b/src/pages/Account/Card/AccountDescriptorMenu.vue @@ -4,9 +4,12 @@ import { computed, ref, toRefs } from 'vue'; import { useI18n } from 'vue-i18n'; import { useVnConfirm } from 'composables/useVnConfirm'; import { useRoute } from 'vue-router'; +import { useAcl } from 'src/composables/useAcl'; import { useArrayData } from 'src/composables/useArrayData'; import VnConfirm from 'src/components/ui/VnConfirm.vue'; +import VnChangePassword from 'src/components/common/VnChangePassword.vue'; import useNotify from 'src/composables/useNotify.js'; + const $props = defineProps({ hasAccount: { type: Boolean, @@ -62,6 +65,19 @@ async function sync() { } + + {{ t('globals.changePass') }} + {{ t('account.card.actions.sync.name') }} - diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index ba906a144..1db32c752 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -56,7 +56,7 @@ async function hasCustomerRole() { @@ -209,5 +209,4 @@ const handlePhotoUpdated = (evt = false) => { es: Click to allow the user to be disabled: Marcar para deshabilitar Click to exclude the user from getting disabled: Marcar para no deshabilitar - Change password: Cambiar contraseña