diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue index ccf029e44..9e573b1bd 100644 --- a/src/pages/Account/Card/AccountDescriptorMenu.vue +++ b/src/pages/Account/Card/AccountDescriptorMenu.vue @@ -34,6 +34,12 @@ account.value.hasAccount = hasAccount.value; const entityId = computed(() => +route.params.id); const hasitManagementAccess = ref(); const hasSysadminAccess = ref(); +const isHimself = computed(() => user.value.id === account.value.id); +const url = computed(() => + isHimself.value + ? 'Accounts/change-password' + : `Accounts/${entityId.value}/setPassword` +); async function updateStatusAccount(active) { if (active) { @@ -106,11 +112,8 @@ onMounted(() => { :ask-old-pass="askOldPass" :submit-fn=" async (newPassword, oldPassword) => { - await axios.patch(`Accounts/change-password`, { - userId: entityId, - newPassword, - oldPassword, - }); + const body = isHimself ? { userId: entityId, oldPassword } : {}; + await axios.patch(url, { ...body, newPassword }); } " /> @@ -158,16 +161,10 @@ onMounted(() => { > {{ t('globals.delete') }} - - - {{ t('globals.changePass') }} + + + {{ isHimself ? t('globals.changePass') : t('globals.setPass') }} - {{ t('globals.setPass') }}