fix: #318 enable confirm button when newPwd or newConfirmPwd is changed
This commit is contained in:
@@ -197,30 +197,15 @@ export default defineComponent({
|
||||
return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit');
|
||||
});
|
||||
|
||||
const hasAtLeastOneEmptyField = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest) => {
|
||||
return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length
|
||||
|| !inputConfirmPwdToTest?.length;
|
||||
}
|
||||
|
||||
const shouldDisalbeConfirmButton = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest,
|
||||
) => {
|
||||
console.log('inputAccountToTest?.length', inputAccountToTest?.length);
|
||||
return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length
|
||||
|| !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest;
|
||||
return hasAtLeastOneEmptyField(inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest) || !inputPwdMatchedToTest;
|
||||
}
|
||||
|
||||
// watch( TODO:暫時註解
|
||||
// [inputUserAccount, inputName, inputPwd, inputConfirmPwd,
|
||||
// isPwdMatched,
|
||||
// ],
|
||||
// async ([newAccount, newName, newPwd, newConfirmPwd,
|
||||
// newPwdMatched,
|
||||
// ]) => {
|
||||
|
||||
// if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) {
|
||||
// isConfirmDisabled.value = true;
|
||||
// } else {
|
||||
// isConfirmDisabled.value = false;
|
||||
// }
|
||||
// },
|
||||
// { immediate: true }
|
||||
// );
|
||||
|
||||
|
||||
const togglePwdEyeBtn = () => {
|
||||
isPwdEyeOn.value = !isPwdEyeOn.value;
|
||||
@@ -335,8 +320,8 @@ export default defineComponent({
|
||||
([newPwd, newConfirmPwd]) => {
|
||||
isPwdMatched.value = newPwd === newConfirmPwd && newPwd.length;
|
||||
// 只要[確認密碼]或[密碼]有更動,confirm 按鈕就可點選
|
||||
if (newPwd || newConfirmPwd) {
|
||||
// isConfirmDisabled.value = false;
|
||||
if ((newPwd || newConfirmPwd) && inputUserAccount.length && inputName.length) {
|
||||
isConfirmDisabled.value = false;
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user