consider the situation when reset section is not open. consider the situation when password is not sent to backend
This commit is contained in:
@@ -234,7 +234,7 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const validatePwdLength = () => {
|
const validatePwdLength = () => {
|
||||||
isPwdLengthValid.value = inputPwd.value.length >= PWD_VALID_LENGTH;
|
isPwdLengthValid.value = !isResetPwdSectionShow.value || inputPwd.value.length >= PWD_VALID_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const onInputDoubleClick = () => {
|
const onInputDoubleClick = () => {
|
||||||
@@ -274,13 +274,23 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 要注意的是舊的username跟新的username可以是不同的
|
// 要注意的是舊的username跟新的username可以是不同的
|
||||||
await acctMgmtStore.editAccount(
|
// 區分有無傳入密碼的情況
|
||||||
currentViewingUser.value.username, {
|
if(isResetPwdSectionShow.value) {
|
||||||
newUsername: inputUserAccount.value,
|
await acctMgmtStore.editAccount(
|
||||||
password: inputPwd.value,
|
currentViewingUser.value.username, {
|
||||||
name: inputName.value === undefined ? '' : inputName.value,
|
newUsername: inputUserAccount.value,
|
||||||
is_active: true,
|
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"));
|
await toast.success(i18next.t("AcctMgmt.MsgAccountEdited"));
|
||||||
isEditable.value = false;
|
isEditable.value = false;
|
||||||
break;
|
break;
|
||||||
@@ -327,9 +337,10 @@ export default defineComponent({
|
|||||||
[inputPwd, inputUserAccount, inputName],
|
[inputPwd, inputUserAccount, inputName],
|
||||||
([newPwd, newAccount, newName]) => {
|
([newPwd, newAccount, newName]) => {
|
||||||
// 只要[確認密碼]或[密碼]欄位有更動,且所有欄位都不是空的,confirm 按鈕就可點選
|
// 只要[確認密碼]或[密碼]欄位有更動,且所有欄位都不是空的,confirm 按鈕就可點選
|
||||||
if (newPwd.length > 0 && newAccount.length > 0 && newName.length > 0) {
|
if(newAccount.length > 0 && newName.length > 0) {
|
||||||
isConfirmDisabled.value = false;
|
isConfirmDisabled.value = false;
|
||||||
} else {
|
}
|
||||||
|
if(isResetPwdSectionShow.value && newPwd.length < PWD_VALID_LENGTH) {
|
||||||
isConfirmDisabled.value = true;
|
isConfirmDisabled.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user