This commit is contained in:
parent
05f3a3f31b
commit
a94fd1a61c
|
@ -221,5 +221,6 @@
|
||||||
"printerNotExists": "The printer does not exist",
|
"printerNotExists": "The printer does not exist",
|
||||||
"There are not picking tickets": "There are not picking tickets",
|
"There are not picking tickets": "There are not picking tickets",
|
||||||
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
|
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
|
||||||
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves"
|
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
||||||
|
"They're not your subordinate": "They're not your subordinate"
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,5 +348,6 @@
|
||||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||||
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
||||||
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario"
|
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
|
||||||
|
"They're not your subordinate": "No es tu subordinado/a."
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const ForbiddenError = require('vn-loopback/util/forbiddenError');
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('setPassword', {
|
Self.remoteMethodCtx('setPassword', {
|
||||||
description: 'Set a new password',
|
description: 'Set a new password',
|
||||||
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const isSubordinate = await Self.isSubordinate(ctx, id, myOptions);
|
const isSubordinate = await Self.isSubordinate(ctx, id, myOptions);
|
||||||
if (!isSubordinate) throw new UserError('You don\'t have enough privileges.');
|
if (!isSubordinate) throw new ForbiddenError('They\'re not your subordinate');
|
||||||
|
|
||||||
await models.Account.setUnverifiedPassword(id, newPass, myOptions);
|
await models.Account.setUnverifiedPassword(id, newPass, myOptions);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('worker setPassword()', () => {
|
||||||
await models.Worker.setPassword(ctx, administrativeId, newPass, options);
|
await models.Worker.setPassword(ctx, administrativeId, newPass, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toEqual(`You don't have enough privileges.`);
|
expect(e.message).toEqual(`They're not your subordinate`);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue