Merge branch 'main' into next

This commit is contained in:
xilesun 2024-11-07 21:16:09 +08:00
commit d5a7d7c8e7
7 changed files with 12 additions and 10 deletions

View File

@ -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"
}

View File

@ -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": "用户名/邮箱或密码有误,请重新输入"
}

View File

@ -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 () => {

View File

@ -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<PasswordField>('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;
}

View File

@ -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"
}

View File

@ -1,5 +1,5 @@
{
"unique violation": "{{field}} 字段值是唯一的",
"unique violation": "{{field}} 字段值已存在",
"notNull violation": "{{field}} 字段不能为空",
"Validation error": "{{field}} 字段规则验证失败"
}

View File

@ -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'] }),
}),
};
}),