From 247a4dbef8f5990eb3cd514aa68b596c004fae9a Mon Sep 17 00:00:00 2001 From: Cindy Chang Date: Mon, 26 Aug 2024 11:50:13 +0800 Subject: [PATCH 1/3] mousedown mouseup eye button --- .../ModalAccountEditCreate.vue | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/views/AccountManagement/ModalAccountEditCreate.vue b/src/views/AccountManagement/ModalAccountEditCreate.vue index 119848b..fe97800 100644 --- a/src/views/AccountManagement/ModalAccountEditCreate.vue +++ b/src/views/AccountManagement/ModalAccountEditCreate.vue @@ -58,12 +58,13 @@ - - eye + + eye -
acctMgmtStore.currentViewingUser); const isPwdEyeOn = ref(false); const isPwdConfirmEyeOn = ref(false); - const isPwdMatched = ref(true); const isPwdLengthValid = ref(true); const isConfirmDisabled = ref(true); @@ -205,17 +205,13 @@ export default defineComponent({ return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit'); }); - const togglePwdEyeBtn = () => { - isPwdEyeOn.value = !isPwdEyeOn.value; + const togglePwdEyeBtn = (toBeOpen) => { + isPwdEyeOn.value = toBeOpen; }; const togglePwdConfirmEyeBtn = () => { isPwdConfirmEyeOn.value = !isPwdConfirmEyeOn.value; }; - const validateConfirmPwd = () => { - isPwdMatched.value = inputPwd.value.length > 0 && inputPwd.value === inputConfirmPwd.value; - } - const validatePwdLength = () => { isPwdLengthValid.value = inputPwd.value.length >= PWD_VALID_LENGTH; } @@ -226,12 +222,6 @@ export default defineComponent({ } const onConfirmBtnClick = async () => { - // rule for matching of confirm password - validateConfirmPwd(); - if(!isPwdMatched.value){ - return; - } - // rule for minimum length validatePwdLength(); if(!isPwdLengthValid.value) { @@ -305,7 +295,6 @@ export default defineComponent({ watch( [inputPwd, inputConfirmPwd, inputUserAccount, inputName], ([newPwd, newConfirmPwd, newAccount, newName]) => { - isPwdMatched.value = newPwd === newConfirmPwd && newPwd.length; isPwdLengthValid.value = newPwd.length >= PWD_VALID_LENGTH && newConfirmPwd.length >= PWD_VALID_LENGTH; // 只要[確認密碼]或[密碼]欄位有更動,且所有欄位都不是空的,confirm 按鈕就可點選 if (newPwd.length > 0 && newConfirmPwd.length > 0 && newAccount.length > 0 && newName.length > 0) { @@ -316,6 +305,10 @@ export default defineComponent({ } ); + onMounted(() => { + + }); + return { isConfirmDisabled, username, @@ -325,7 +318,6 @@ export default defineComponent({ isPwdConfirmEyeOn, togglePwdEyeBtn, togglePwdConfirmEyeBtn, - isPwdMatched, isPwdLengthValid, inputUserAccount, inputName, From 97e01c93fdb96baa94b41dc7276edc8f0bd5fb6d Mon Sep 17 00:00:00 2001 From: Cindy Chang Date: Mon, 26 Aug 2024 13:40:33 +0800 Subject: [PATCH 2/3] new version of password edit. Reset button added --- src/i18n/en.json | 1 + .../ModalAccountEditCreate.vue | 99 ++++++++++++------- 2 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/i18n/en.json b/src/i18n/en.json index 38df966..ea9a824 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -29,6 +29,7 @@ "Detail": "Detail", "Edit": "Edit", "Delete": "Delete", + "Reset": "Reset", "AccountEdit": "Account Edit", "AccountInformation": "Account Information", "Password": "Password", diff --git a/src/views/AccountManagement/ModalAccountEditCreate.vue b/src/views/AccountManagement/ModalAccountEditCreate.vue index fe97800..8b0964a 100644 --- a/src/views/AccountManagement/ModalAccountEditCreate.vue +++ b/src/views/AccountManagement/ModalAccountEditCreate.vue @@ -47,26 +47,53 @@ autocomplete="off" />
-
-
- - {{ i18next.t("AcctMgmt.Password") }} - -
-
- - - eye -
+
+ + {{ i18next.t("AcctMgmt.Password") }} + +
+
+ +
+
+ + + eye +
+
+ ! + + {{ isPwdLengthValid ? "" : i18next.t("AcctMgmt.PwdLengthNotEnough") }} + +
+
+
- -
- - -