diff --git a/packages/plugins/@nocobase/plugin-auth/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-auth/src/locale/en-US.json index f6f77a628c..02d59fbea1 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/locale/en-US.json +++ b/packages/plugins/@nocobase/plugin-auth/src/locale/en-US.json @@ -23,5 +23,6 @@ "No authentication methods available.": "No authentication methods available.", "The password is inconsistent, please re-enter": "The password is inconsistent, please re-enter", "Sign-in": "Sign-in", - "Password": "Password" + "Password": "Password", + "The username/email or password is incorrect, please re-enter": "The username/email or password is incorrect, please re-enter" } diff --git a/packages/plugins/@nocobase/plugin-auth/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-auth/src/locale/zh-CN.json index 1e244da8a7..c8760b1bc4 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-auth/src/locale/zh-CN.json @@ -23,5 +23,6 @@ "No authentication methods available.": "没有可用的认证方式。", "The password is inconsistent, please re-enter": "密码不一致,请重新输入", "Sign-in": "登录", - "Password": "密码" + "Password": "密码", + "The username/email or password is incorrect, please re-enter": "用户名/邮箱或密码有误,请重新输入" } diff --git a/packages/plugins/@nocobase/plugin-auth/src/server/__tests__/actions.test.ts b/packages/plugins/@nocobase/plugin-auth/src/server/__tests__/actions.test.ts index 27f3a96b25..0af9c3c2b5 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/server/__tests__/actions.test.ts +++ b/packages/plugins/@nocobase/plugin-auth/src/server/__tests__/actions.test.ts @@ -117,7 +117,7 @@ describe('actions', () => { email: 'no-exists@nocobase.com', }); expect(res.statusCode).toEqual(401); - expect(res.error.text).toBe('The username or email is incorrect, please re-enter'); + expect(res.error.text).toBe('The username/email or password is incorrect, please re-enter'); }); it('should check password when signing in', async () => { @@ -126,7 +126,7 @@ describe('actions', () => { password: 'incorrect', }); expect(res.statusCode).toEqual(401); - expect(res.error.text).toBe('The password is incorrect, please re-enter'); + expect(res.error.text).toBe('The username/email or password is incorrect, please re-enter'); }); it('should sign in with password', async () => { diff --git a/packages/plugins/@nocobase/plugin-auth/src/server/basic-auth.ts b/packages/plugins/@nocobase/plugin-auth/src/server/basic-auth.ts index 13c80bada1..281b823ef2 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/server/basic-auth.ts +++ b/packages/plugins/@nocobase/plugin-auth/src/server/basic-auth.ts @@ -39,13 +39,13 @@ export class BasicAuth extends BaseAuth { }); if (!user) { - ctx.throw(401, ctx.t('The username or email is incorrect, please re-enter', { ns: namespace })); + ctx.throw(401, ctx.t('The username/email or password is incorrect, please re-enter', { ns: namespace })); } const field = this.userCollection.getField('password'); const valid = await field.verify(password, user.password); if (!valid) { - ctx.throw(401, ctx.t('The password is incorrect, please re-enter', { ns: namespace })); + ctx.throw(401, ctx.t('The username/email or password is incorrect, please re-enter', { ns: namespace })); } return user; } diff --git a/packages/plugins/@nocobase/plugin-error-handler/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-error-handler/src/locale/en-US.json index 1d03ff8807..3601fa9dd1 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/src/locale/en-US.json +++ b/packages/plugins/@nocobase/plugin-error-handler/src/locale/en-US.json @@ -1,6 +1,6 @@ { - "unique violation": "{{field}} must be unique", - "notNull violation": "notNull violation", + "unique violation": "{{field}} already exists", + "notNull violation": "{{field}} cannot be null", "Validation error": "{{field}} validation error", "notNull Violation": "{{field}} cannot be null" } diff --git a/packages/plugins/@nocobase/plugin-error-handler/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-error-handler/src/locale/zh-CN.json index 057a84fbca..7bb4234aca 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-error-handler/src/locale/zh-CN.json @@ -1,5 +1,5 @@ { - "unique violation": "{{field}} 字段值是唯一的", + "unique violation": "{{field}} 字段值已存在", "notNull violation": "{{field}} 字段不能为空", "Validation error": "{{field}} 字段规则验证失败" } diff --git a/packages/plugins/@nocobase/plugin-error-handler/src/server/server.ts b/packages/plugins/@nocobase/plugin-error-handler/src/server/server.ts index 28081e264b..5fd05fa7cf 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/src/server/server.ts +++ b/packages/plugins/@nocobase/plugin-error-handler/src/server/server.ts @@ -54,7 +54,7 @@ export class PluginErrorHandlerServer extends Plugin { return { message: t(err.type, { ns: this.i18nNs, - field: t(title, { ns: 'lm-collections' }), + field: t(title, { ns: ['lm-collections', 'client'] }), }), }; }),