Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show sending status of verification emails in signup form. #7065

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion application/src/main/resources/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,19 @@ const Toast = (function () {
function sendVerificationCode(button, sendRequest) {
let timer;
const countdown = 60;
const originalButtonText = button.textContent;

button.addEventListener("click", () => {
button.disabled = true;
button.textContent = i18nResources.sendVerificationCodeSending;
sendRequest()
.then(() => {
startCountdown();
Toast.success(i18nResources.sendVerificationCodeSuccess);
})
.catch((e) => {
button.disabled = false;
button.textContent = originalButtonText;
if (e instanceof Error) {
Toast.error(e.message);
} else {
Expand All @@ -119,7 +122,7 @@ function sendVerificationCode(button, sendRequest) {
remainingTime--;
} else {
clearInterval(timer);
button.textContent = "Send";
button.textContent = originalButtonText;
button.disabled = false;
button.classList.remove("disabled");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
const i18nResources = {
sendVerificationCodeSuccess: `[(#{js.sendVerificationCode.success})]`,
sendVerificationCodeFailed: `[(#{js.sendVerificationCode.failed})]`,
sendVerificationCodeSending: `[(#{js.sendVerificationCode.sending})]`,
passwordConfirmationFailed: `[(#{js.passwordConfirmation.failed})]`,
};
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
socialLogin.label=社交登录
js.sendVerificationCode.success=发送成功
js.sendVerificationCode.failed=发送失败,请稍后再试
js.sendVerificationCode.sending=发送中...
js.passwordConfirmation.failed=确认密码不匹配

signupNotice.description=没有账号?
Expand Down
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
socialLogin.label=社交登入
js.sendVerificationCode.success=發送成功
js.sendVerificationCode.failed=發送失敗,請稍後再試
js.sendVerificationCode.sending=發送中...
js.passwordConfirmation.failed=確認密碼不匹配

signupNotice.description=沒有帳號?
Expand Down