From c9f30a2f7cdc6e267b7fbc090f575555e7af17f1 Mon Sep 17 00:00:00 2001 From: zly19 Date: Fri, 22 Nov 2024 23:36:51 +0900 Subject: [PATCH 1/4] feat: Show "Sending..." state immediately after clicking the send button, start countdown only after successful request --- application/src/main/resources/static/js/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/main/resources/static/js/main.js b/application/src/main/resources/static/js/main.js index 241caa097b..64ae56d63f 100644 --- a/application/src/main/resources/static/js/main.js +++ b/application/src/main/resources/static/js/main.js @@ -93,6 +93,7 @@ function sendVerificationCode(button, sendRequest) { button.addEventListener("click", () => { button.disabled = true; + button.textContent = "Sending..."; sendRequest() .then(() => { startCountdown(); @@ -100,6 +101,7 @@ function sendVerificationCode(button, sendRequest) { }) .catch((e) => { button.disabled = false; + button.textContent = "Send"; if (e instanceof Error) { Toast.error(e.message); } else { From 14a6288cdad9bf89d70616253d2379806c00ffd7 Mon Sep 17 00:00:00 2001 From: zly19 Date: Tue, 26 Nov 2024 20:59:56 +0900 Subject: [PATCH 2/4] feat: make name field optional during registration --- application/src/main/resources/static/js/main.js | 8 ++++---- .../resources/templates/gateway_fragments/signup.html | 4 +++- .../templates/gateway_fragments/signup.properties | 1 + .../templates/gateway_fragments/signup_en.properties | 1 + .../templates/gateway_fragments/signup_es.properties | 1 + .../templates/gateway_fragments/signup_zh_TW.properties | 1 + 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/application/src/main/resources/static/js/main.js b/application/src/main/resources/static/js/main.js index 64ae56d63f..1ad8851b17 100644 --- a/application/src/main/resources/static/js/main.js +++ b/application/src/main/resources/static/js/main.js @@ -87,13 +87,13 @@ const Toast = (function () { }; })(); -function sendVerificationCode(button, sendRequest) { +function sendVerificationCode(button, sendRequest,sentButtonName,sendingButtonName) { let timer; const countdown = 60; button.addEventListener("click", () => { button.disabled = true; - button.textContent = "Sending..."; + button.textContent = sendingButtonName; sendRequest() .then(() => { startCountdown(); @@ -101,7 +101,7 @@ function sendVerificationCode(button, sendRequest) { }) .catch((e) => { button.disabled = false; - button.textContent = "Send"; + button.textContent = sentButtonName; if (e instanceof Error) { Toast.error(e.message); } else { @@ -121,7 +121,7 @@ function sendVerificationCode(button, sendRequest) { remainingTime--; } else { clearInterval(timer); - button.textContent = "Send"; + button.textContent = sentButtonName; button.disabled = false; button.classList.remove("disabled"); } diff --git a/application/src/main/resources/templates/gateway_fragments/signup.html b/application/src/main/resources/templates/gateway_fragments/signup.html index fc6fa7c71d..10a8996848 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup.html +++ b/application/src/main/resources/templates/gateway_fragments/signup.html @@ -152,7 +152,9 @@ } const emailCodeSendButton = document.getElementById("emailCodeSendButton"); - sendVerificationCode(emailCodeSendButton, sendRequest); + const sendingButtonName = /*[[#{form.emailCode.sending}]]*/ ""; + const sentButtonName = /*[[#{form.emailCode.sendButton}]]*/ ""; + sendVerificationCode(emailCodeSendButton, sendRequest,sentButtonName,sendingButtonName); }); diff --git a/application/src/main/resources/templates/gateway_fragments/signup.properties b/application/src/main/resources/templates/gateway_fragments/signup.properties index d5275f7614..bc12962fbc 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup.properties @@ -3,6 +3,7 @@ form.displayName.label=名称 form.email.label=电子邮箱 form.emailCode.label=邮箱验证码 form.emailCode.sendButton=发送 +form.emailCode.sending=发送中 form.emailCode.send.emptyValidation=请先输入邮箱地址 form.password.label=密码 form.confirmPassword.label=确认密码 diff --git a/application/src/main/resources/templates/gateway_fragments/signup_en.properties b/application/src/main/resources/templates/gateway_fragments/signup_en.properties index 3d56c1fca3..1d4ccc8157 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_en.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_en.properties @@ -3,6 +3,7 @@ form.displayName.label=Display Name form.email.label=Email form.emailCode.label=Email Verification Code form.emailCode.sendButton=Send +form.emailCode.sending=Sending form.emailCode.send.emptyValidation=Please enter your email address first form.password.label=Password form.confirmPassword.label=Confirm Password diff --git a/application/src/main/resources/templates/gateway_fragments/signup_es.properties b/application/src/main/resources/templates/gateway_fragments/signup_es.properties index 9ebb2bcbc0..7245681c14 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_es.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_es.properties @@ -3,6 +3,7 @@ form.displayName.label=Nombre form.email.label=Correo Electrónico form.emailCode.label=Código de Verificación form.emailCode.sendButton=Enviar +form.emailCode.sending=Enviando form.emailCode.send.emptyValidation=Por favor, introduce tu dirección de correo electrónico primero form.password.label=Contraseña form.confirmPassword.label=Confirmar Contraseña diff --git a/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties b/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties index 5135787d07..45271068fe 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties @@ -3,6 +3,7 @@ form.displayName.label=名稱 form.email.label=電子郵件 form.emailCode.label=郵箱驗證碼 form.emailCode.sendButton=發送 +form.emailCode.sending=發送中 form.emailCode.send.emptyValidation=請先輸入電子郵件地址 form.password.label=密碼 form.confirmPassword.label=確認密碼 From d61a4ee9852ca651b10bb4c5e9257c4b29f48cd9 Mon Sep 17 00:00:00 2001 From: zly19 Date: Sun, 1 Dec 2024 18:29:09 +0900 Subject: [PATCH 3/4] feat:Simplify verification code button text handling. Removed unnecessary parameters for button text during verification code sending process. Introduced localization for "Sending..." status message, enhancing user feedback in different languages. --- application/src/main/resources/static/js/main.js | 9 +++++---- .../resources/templates/gateway_fragments/common.html | 1 + .../templates/gateway_fragments/common.properties | 1 + .../templates/gateway_fragments/common_en.properties | 1 + .../templates/gateway_fragments/common_es.properties | 1 + .../templates/gateway_fragments/common_zh_TW.properties | 1 + .../resources/templates/gateway_fragments/signup.html | 4 +--- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/application/src/main/resources/static/js/main.js b/application/src/main/resources/static/js/main.js index 1ad8851b17..269b35a52f 100644 --- a/application/src/main/resources/static/js/main.js +++ b/application/src/main/resources/static/js/main.js @@ -87,13 +87,14 @@ const Toast = (function () { }; })(); -function sendVerificationCode(button, sendRequest,sentButtonName,sendingButtonName) { +function sendVerificationCode(button, sendRequest) { let timer; const countdown = 60; + const originalButtonText = button.textContent; button.addEventListener("click", () => { button.disabled = true; - button.textContent = sendingButtonName; + button.textContent = i18nResources.sendVerificationCodeSending; sendRequest() .then(() => { startCountdown(); @@ -101,7 +102,7 @@ function sendVerificationCode(button, sendRequest,sentButtonName,sendingButtonNa }) .catch((e) => { button.disabled = false; - button.textContent = sentButtonName; + button.textContent = originalButtonText; if (e instanceof Error) { Toast.error(e.message); } else { @@ -121,7 +122,7 @@ function sendVerificationCode(button, sendRequest,sentButtonName,sendingButtonNa remainingTime--; } else { clearInterval(timer); - button.textContent = sentButtonName; + button.textContent = originalButtonText; button.disabled = false; button.classList.remove("disabled"); } diff --git a/application/src/main/resources/templates/gateway_fragments/common.html b/application/src/main/resources/templates/gateway_fragments/common.html index 127692d41c..296af122c8 100644 --- a/application/src/main/resources/templates/gateway_fragments/common.html +++ b/application/src/main/resources/templates/gateway_fragments/common.html @@ -8,6 +8,7 @@ const i18nResources = { sendVerificationCodeSuccess: `[(#{js.sendVerificationCode.success})]`, sendVerificationCodeFailed: `[(#{js.sendVerificationCode.failed})]`, + sendVerificationCodeSending: `[(#{js.sendVerificationCode.sending})]`, passwordConfirmationFailed: `[(#{js.passwordConfirmation.failed})]`, }; diff --git a/application/src/main/resources/templates/gateway_fragments/common.properties b/application/src/main/resources/templates/gateway_fragments/common.properties index 22053bc75c..526bdbe513 100644 --- a/application/src/main/resources/templates/gateway_fragments/common.properties +++ b/application/src/main/resources/templates/gateway_fragments/common.properties @@ -1,6 +1,7 @@ socialLogin.label=社交登录 js.sendVerificationCode.success=发送成功 js.sendVerificationCode.failed=发送失败,请稍后再试 +js.sendVerificationCode.sending=发送中... js.passwordConfirmation.failed=确认密码不匹配 signupNotice.description=没有账号? diff --git a/application/src/main/resources/templates/gateway_fragments/common_en.properties b/application/src/main/resources/templates/gateway_fragments/common_en.properties index 70af7ab8db..ef1ab42f41 100644 --- a/application/src/main/resources/templates/gateway_fragments/common_en.properties +++ b/application/src/main/resources/templates/gateway_fragments/common_en.properties @@ -1,6 +1,7 @@ socialLogin.label=Social Login js.sendVerificationCode.success=Sent Successfully js.sendVerificationCode.failed=Sending Failed, Please Try Again Later +js.sendVerificationCode.sending=Sending... js.passwordConfirmation.failed=Password confirmation does not match signupNotice.description=Don't have an account? diff --git a/application/src/main/resources/templates/gateway_fragments/common_es.properties b/application/src/main/resources/templates/gateway_fragments/common_es.properties index db6c8cef4f..e786b10d35 100644 --- a/application/src/main/resources/templates/gateway_fragments/common_es.properties +++ b/application/src/main/resources/templates/gateway_fragments/common_es.properties @@ -1,6 +1,7 @@ socialLogin.label=Inicio de Sesión Social js.sendVerificationCode.success=Enviado con éxito js.sendVerificationCode.failed=Error al enviar, por favor intente nuevamente más tarde +js.sendVerificationCode.sending=Enviando... js.passwordConfirmation.failed=La confirmación de la contraseña no coincide signupNotice.description=¿No tienes una cuenta? diff --git a/application/src/main/resources/templates/gateway_fragments/common_zh_TW.properties b/application/src/main/resources/templates/gateway_fragments/common_zh_TW.properties index 63129e1666..c06c3afd1a 100644 --- a/application/src/main/resources/templates/gateway_fragments/common_zh_TW.properties +++ b/application/src/main/resources/templates/gateway_fragments/common_zh_TW.properties @@ -1,6 +1,7 @@ socialLogin.label=社交登入 js.sendVerificationCode.success=發送成功 js.sendVerificationCode.failed=發送失敗,請稍後再試 +js.sendVerificationCode.sending=發送中... js.passwordConfirmation.failed=確認密碼不匹配 signupNotice.description=沒有帳號? diff --git a/application/src/main/resources/templates/gateway_fragments/signup.html b/application/src/main/resources/templates/gateway_fragments/signup.html index 10a8996848..fc6fa7c71d 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup.html +++ b/application/src/main/resources/templates/gateway_fragments/signup.html @@ -152,9 +152,7 @@ } const emailCodeSendButton = document.getElementById("emailCodeSendButton"); - const sendingButtonName = /*[[#{form.emailCode.sending}]]*/ ""; - const sentButtonName = /*[[#{form.emailCode.sendButton}]]*/ ""; - sendVerificationCode(emailCodeSendButton, sendRequest,sentButtonName,sendingButtonName); + sendVerificationCode(emailCodeSendButton, sendRequest); }); From b41b007732fe5e8a9f42655c3f41727ee033b20c Mon Sep 17 00:00:00 2001 From: zly19 Date: Mon, 2 Dec 2024 22:11:06 +0900 Subject: [PATCH 4/4] feat:Simplify verification code button text handling. --- .../main/resources/templates/gateway_fragments/signup.properties | 1 - .../resources/templates/gateway_fragments/signup_en.properties | 1 - .../resources/templates/gateway_fragments/signup_es.properties | 1 - .../templates/gateway_fragments/signup_zh_TW.properties | 1 - 4 files changed, 4 deletions(-) diff --git a/application/src/main/resources/templates/gateway_fragments/signup.properties b/application/src/main/resources/templates/gateway_fragments/signup.properties index bc12962fbc..d5275f7614 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup.properties @@ -3,7 +3,6 @@ form.displayName.label=名称 form.email.label=电子邮箱 form.emailCode.label=邮箱验证码 form.emailCode.sendButton=发送 -form.emailCode.sending=发送中 form.emailCode.send.emptyValidation=请先输入邮箱地址 form.password.label=密码 form.confirmPassword.label=确认密码 diff --git a/application/src/main/resources/templates/gateway_fragments/signup_en.properties b/application/src/main/resources/templates/gateway_fragments/signup_en.properties index 1d4ccc8157..3d56c1fca3 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_en.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_en.properties @@ -3,7 +3,6 @@ form.displayName.label=Display Name form.email.label=Email form.emailCode.label=Email Verification Code form.emailCode.sendButton=Send -form.emailCode.sending=Sending form.emailCode.send.emptyValidation=Please enter your email address first form.password.label=Password form.confirmPassword.label=Confirm Password diff --git a/application/src/main/resources/templates/gateway_fragments/signup_es.properties b/application/src/main/resources/templates/gateway_fragments/signup_es.properties index 7245681c14..9ebb2bcbc0 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_es.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_es.properties @@ -3,7 +3,6 @@ form.displayName.label=Nombre form.email.label=Correo Electrónico form.emailCode.label=Código de Verificación form.emailCode.sendButton=Enviar -form.emailCode.sending=Enviando form.emailCode.send.emptyValidation=Por favor, introduce tu dirección de correo electrónico primero form.password.label=Contraseña form.confirmPassword.label=Confirmar Contraseña diff --git a/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties b/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties index 45271068fe..5135787d07 100644 --- a/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties +++ b/application/src/main/resources/templates/gateway_fragments/signup_zh_TW.properties @@ -3,7 +3,6 @@ form.displayName.label=名稱 form.email.label=電子郵件 form.emailCode.label=郵箱驗證碼 form.emailCode.sendButton=發送 -form.emailCode.sending=發送中 form.emailCode.send.emptyValidation=請先輸入電子郵件地址 form.password.label=密碼 form.confirmPassword.label=確認密碼