mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:39:34 +00:00
chore(auth): optimize error message (#5612)
This commit is contained in:
parent
666c92d524
commit
e70d2d1c9e
@ -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"
|
||||
}
|
||||
|
@ -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": "用户名/邮箱或密码有误,请重新输入"
|
||||
}
|
||||
|
@ -116,7 +116,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 () => {
|
||||
@ -125,7 +125,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 () => {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export default {
|
||||
'The email is incorrect, please re-enter': 'The email is incorrect, please re-enter',
|
||||
'Please fill in your email address': 'Please fill in your email address',
|
||||
'The password is incorrect, please re-enter': 'The password is incorrect, please re-enter',
|
||||
'Not a valid cellphone number, please re-enter': 'Not a valid cellphone number, please re-enter',
|
||||
'The phone number has been registered, please login directly':
|
||||
'The phone number has been registered, please login directly',
|
||||
'The phone number is not registered, please register first':
|
||||
'The phone number is not registered, please register first',
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export default {
|
||||
'The email is incorrect, please re-enter': 'L\'email est incorrect, veuillez le saisir à nouveau',
|
||||
'Please fill in your email address': 'Veuillez remplir votre adresse e-mail',
|
||||
'The password is incorrect, please re-enter': 'Le mot de passe est incorrect, veuillez le saisir à nouveau',
|
||||
'Not a valid cellphone number, please re-enter': 'Numéro de téléphone portable non valide, veuillez le saisir à nouveau',
|
||||
'The phone number has been registered, please login directly':
|
||||
'Le numéro de téléphone a été enregistré, veuillez vous connecter directement',
|
||||
'The phone number is not registered, please register first':
|
||||
'Le numéro de téléphone n\'est pas enregistré, veuillez vous inscrire d\'abord',
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export { default as enUS } from './en-US';
|
||||
export { default as zhCN } from './zh-CN';
|
||||
export { default as ptBR } from './pt-BR';
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export default {
|
||||
'Please fill in your email address': 'メールアドレスを入力してください',
|
||||
'The password is incorrect, please re-enter': 'パスワードが正しくありません。再度入力してください。',
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export default {
|
||||
'The email is incorrect, please re-enter': 'O e-mail está incorreto, por favor, digite novamente',
|
||||
'Please fill in your email address': 'Por favor, preencha o seu endereço de e-mail',
|
||||
'The password is incorrect, please re-enter': 'A senha está incorreta, por favor, digite novamente',
|
||||
'Not a valid cellphone number, please re-enter': 'Número de celular inválido, por favor, digite novamente',
|
||||
'The phone number has been registered, please login directly':
|
||||
'O número de celular já está registrado, por favor, faça login diretamente',
|
||||
'The phone number is not registered, please register first':
|
||||
'O número de celular não está registrado, por favor, registre-se primeiro',
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
export default {
|
||||
'The username or email is incorrect, please re-enter': '用户名或邮箱有误,请重新输入',
|
||||
'The password is incorrect, please re-enter': '密码有误,请重新输入',
|
||||
'Not a valid cellphone number, please re-enter': '不是有效的手机号,请重新输入',
|
||||
'The phone number has been registered, please login directly': '手机号已注册,请直接登录',
|
||||
'The phone number is not registered, please register first': '手机号未注册,请先注册',
|
||||
'Please keep and enable at least one authenticator': '请至少保留并启用一个认证器',
|
||||
'Please enter your username or email': '请输入用户名或邮箱',
|
||||
'Please enter a valid username': '请输入有效的用户名',
|
||||
};
|
@ -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"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"unique violation": "{{field}} 字段值是唯一的",
|
||||
"unique violation": "{{field}} 字段值已存在",
|
||||
"notNull violation": "{{field}} 字段不能为空",
|
||||
"Validation error": "{{field}} 字段规则验证失败"
|
||||
}
|
||||
|
@ -56,7 +56,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'] }),
|
||||
}),
|
||||
};
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user