From 9ffbb96855f204263ce9d20204912bf027a7addc Mon Sep 17 00:00:00 2001 From: Kuon Date: Mon, 11 Sep 2023 16:13:23 +0800 Subject: [PATCH] feat(login): separate error messages for validation This commit separates the error messages for credential and captcha validation on the login page. Previously, both types of errors displayed the same message, which was confusing for users. Now, distinct messages are shown depending on the error, improving user experience. --- frontend/src/i18n/en.json | 3 ++- frontend/src/i18n/ja.json | 5 +++-- frontend/src/i18n/zh-cn.json | 3 ++- frontend/src/i18n/zh-tw.json | 5 +++-- frontend/src/views/Login.vue | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index d9ba48cc..60ff24c8 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -122,7 +122,8 @@ "submit": "Login", "username": "Username", "usernameTaken": "Username already taken", - "wrongCredentials": "Wrong credentials" + "wrongCredentials": "Wrong credentials", + "captchaNeeded": "Captcha Needed" }, "permanent": "Permanent", "prompts": { diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json index d6253050..7f19018c 100644 --- a/frontend/src/i18n/ja.json +++ b/frontend/src/i18n/ja.json @@ -96,7 +96,7 @@ "ru": "Русский", "sk": "Slovenčina", "svSE": "", - "tr" : "Türkçe", + "tr": "Türkçe", "ua": "Українська", "zhCN": "中文 (简体)", "zhTW": "中文 (繁體)" @@ -111,7 +111,8 @@ "submit": "ログイン", "username": "ユーザ名", "usernameTaken": "Username already taken", - "wrongCredentials": "ユーザ名またはパスワードが間違っています。" + "wrongCredentials": "ユーザ名またはパスワードが間違っています。", + "captchaNeeded": "キャプチャが必要です" }, "permanent": "永久", "prompts": { diff --git a/frontend/src/i18n/zh-cn.json b/frontend/src/i18n/zh-cn.json index f5b730f6..5aca2b16 100644 --- a/frontend/src/i18n/zh-cn.json +++ b/frontend/src/i18n/zh-cn.json @@ -117,7 +117,8 @@ "submit": "登录", "username": "用户名", "usernameTaken": "用户名已经被使用", - "wrongCredentials": "用户名或密码错误" + "wrongCredentials": "用户名或密码错误", + "captchaNeeded": "需要验证" }, "permanent": "永久", "prompts": { diff --git a/frontend/src/i18n/zh-tw.json b/frontend/src/i18n/zh-tw.json index 096a9fbc..cd1b4045 100644 --- a/frontend/src/i18n/zh-tw.json +++ b/frontend/src/i18n/zh-tw.json @@ -96,7 +96,7 @@ "ru": "Русский", "sk": "Slovenčina", "svSE": "Swedish(Sweden)", - "tr" : "Türkçe", + "tr": "Türkçe", "ua": "Українська", "zhCN": "中文 (简体)", "zhTW": "中文 (繁體)" @@ -111,7 +111,8 @@ "submit": "登入", "username": "帳號", "usernameTaken": "用戶名已存在", - "wrongCredentials": "帳號或密碼錯誤" + "wrongCredentials": "帳號或密碼錯誤", + "captchaNeeded": "需要驗證碼" }, "permanent": "永久", "prompts": { diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue index 51e5d1cb..b27cdc8f 100644 --- a/frontend/src/views/Login.vue +++ b/frontend/src/views/Login.vue @@ -97,7 +97,7 @@ export default { captcha = window.grecaptcha.getResponse(); if (captcha === "") { - this.error = this.$t("login.wrongCredentials"); + this.error = this.$t("login.captchaNeeded"); return; } }