diff --git a/src/views/AccountManagement/ModalAccountEditCreate.vue b/src/views/AccountManagement/ModalAccountEditCreate.vue index 8b0964a..237cd67 100644 --- a/src/views/AccountManagement/ModalAccountEditCreate.vue +++ b/src/views/AccountManagement/ModalAccountEditCreate.vue @@ -234,7 +234,7 @@ export default defineComponent({ }; const validatePwdLength = () => { - isPwdLengthValid.value = inputPwd.value.length >= PWD_VALID_LENGTH; + isPwdLengthValid.value = !isResetPwdSectionShow.value || inputPwd.value.length >= PWD_VALID_LENGTH; } const onInputDoubleClick = () => { @@ -274,13 +274,23 @@ export default defineComponent({ return; } // 要注意的是舊的username跟新的username可以是不同的 - await acctMgmtStore.editAccount( - currentViewingUser.value.username, { - newUsername: inputUserAccount.value, - password: inputPwd.value, - name: inputName.value === undefined ? '' : inputName.value, - is_active: true, - }); + // 區分有無傳入密碼的情況 + if(isResetPwdSectionShow.value) { + await acctMgmtStore.editAccount( + currentViewingUser.value.username, { + newUsername: inputUserAccount.value, + password: inputPwd.value, + name: inputName.value === undefined ? '' : inputName.value, + is_active: true, + }); + } else { + await acctMgmtStore.editAccount( + currentViewingUser.value.username, { + newUsername: inputUserAccount.value, + name: inputName.value === undefined ? '' : inputName.value, + is_active: true, + }); + } await toast.success(i18next.t("AcctMgmt.MsgAccountEdited")); isEditable.value = false; break; @@ -327,11 +337,12 @@ export default defineComponent({ [inputPwd, inputUserAccount, inputName], ([newPwd, newAccount, newName]) => { // 只要[確認密碼]或[密碼]欄位有更動,且所有欄位都不是空的,confirm 按鈕就可點選 - if (newPwd.length > 0 && newAccount.length > 0 && newName.length > 0) { + if(newAccount.length > 0 && newName.length > 0) { isConfirmDisabled.value = false; - } else { - isConfirmDisabled.value = true; } + if(isResetPwdSectionShow.value && newPwd.length < PWD_VALID_LENGTH) { + isConfirmDisabled.value = true; + } } );