fix: localize validation and api messages
This commit is contained in:
@@ -34,7 +34,7 @@ const registerAuth: FastifyPluginAsync = async (app) => {
|
||||
try {
|
||||
await request.jwtVerify();
|
||||
} catch {
|
||||
reply.code(401).send({ error: 'Authentication required' });
|
||||
reply.code(401).send({ error: 'Autenticação necessária.' });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const registerAuth: FastifyPluginAsync = async (app) => {
|
||||
);
|
||||
const account = result.rows[0];
|
||||
if (!account) {
|
||||
reply.code(401).send({ error: 'This account is no longer active' });
|
||||
reply.code(401).send({ error: 'Esta conta não está mais ativa.' });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ const registerAuth: FastifyPluginAsync = async (app) => {
|
||||
if (!(await verifyActiveUser(request, reply))) return;
|
||||
|
||||
if (!roles.includes(request.user.role)) {
|
||||
return reply.code(403).send({ error: 'Insufficient permissions' });
|
||||
return reply.code(403).send({ error: 'Você não tem permissão para esta ação.' });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user