This commit is contained in:
Cindy Chang
2024-07-10 10:39:15 +08:00
parent 0d9bfaa40d
commit b70f241ab5

View File

@@ -197,7 +197,7 @@ export default defineComponent({
return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit'); return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit');
}); });
const validateInputLengthAndEquality = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest, const shouldDisalbeConfirmButton = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest,
) => { ) => {
return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length
|| !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest; || !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest;
@@ -291,7 +291,7 @@ export default defineComponent({
watch( watch(
[inputUserAccount, inputName, inputPwd, inputConfirmPwd, isPwdMatched], [inputUserAccount, inputName, inputPwd, inputConfirmPwd, isPwdMatched],
([newAccount, newName, newPwd, newConfirmPwd, newPwdMatched]) => { ([newAccount, newName, newPwd, newConfirmPwd, newPwdMatched]) => {
if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) { if (shouldDisalbeConfirmButton(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) {
isConfirmDisabled.value = true; isConfirmDisabled.value = true;
} else { } else {
isConfirmDisabled.value = false; isConfirmDisabled.value = false;
@@ -299,6 +299,13 @@ export default defineComponent({
}, },
{ immediate: true } { immediate: true }
); );
watch(
[inputPwd, inputConfirmPwd],
([newPwd, newConfirmPwd]) => {
isPwdMatched.value = newPwd === newConfirmPwd && newPwd.length;
}
)
}); });
return { return {