From 16f47f86646e6fd9e2adb9779a6e0859917191b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:40:10 +0800 Subject: [PATCH] fix: Fix the issue of incorrect display of prompts on the English language login page (#7376) --- .../src/views/login/components/login-form.vue | 18 ++++++++++++++++-- frontend/src/views/toolbox/clam/index.vue | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index 3fb325319..56491b679 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -205,11 +205,25 @@ const loginForm = reactive({ }); const loginRules = reactive({ - name: [{ required: true, message: i18n.t('commons.rule.username'), trigger: 'blur' }], - password: [{ required: true, message: i18n.t('commons.rule.password'), trigger: 'blur' }], + name: [{ required: true, validator: checkUsername, trigger: 'blur' }], + password: [{ required: true, validator: checkPassword, trigger: 'blur' }], agreeLicense: [Rules.requiredSelect, { type: 'array', validator: checkAgreeLicense, trigger: 'blur' }], }); +function checkUsername(rule: any, value: any, callback: any) { + if (value === '') { + return callback(new Error(i18n.t('commons.rule.username'))); + } + callback(); +} + +function checkPassword(rule: any, value: any, callback: any) { + if (value === '') { + return callback(new Error(i18n.t('commons.rule.password'))); + } + callback(); +} + function checkAgreeLicense(rule: any, value: any, callback: any) { if (!value && !_isMobile()) { return callback(new Error(i18n.t('commons.login.errorAgree'))); diff --git a/frontend/src/views/toolbox/clam/index.vue b/frontend/src/views/toolbox/clam/index.vue index 48f4dd41f..f7a165d1b 100644 --- a/frontend/src/views/toolbox/clam/index.vue +++ b/frontend/src/views/toolbox/clam/index.vue @@ -146,7 +146,7 @@