Merge pull request '#6744 hotfix show change password' (!2595) from 6744-hotfix-showChangePass into master
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-test There was a failure building this commit Details

Reviewed-on: #2595
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-06-19 14:55:15 +00:00
commit 4b7fa29189
4 changed files with 12 additions and 6 deletions

View File

@ -351,7 +351,7 @@
"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 line could not be marked": "La linea no puede ser marcada",
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
"They're not your subordinate": "No es tu subordinado/a.",
"No results found": "No se han encontrado resultados",
"InvoiceIn is already booked": "La factura recibida está contabilizada",
@ -359,10 +359,10 @@
"Select ticket or client": "Elija un ticket o un client",
"It was not able to create the invoice": "No se pudo crear la factura",
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
"You can not use the same password": "No puedes usar la misma contraseña",
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
"You can only have one PDA": "Solo puedes tener un PDA",
"It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono"
}
}

View File

@ -13,7 +13,11 @@ module.exports = Self => {
Self.setUnverifiedPassword = async(id, pass, options) => {
const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
if (emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves');
if (emailVerified) {
throw new ForbiddenError(
'Through this procedure, it is not possible to modify the password of users with verified email'
);
}
await models.VnUser.setPassword(id, pass, options);
};

View File

@ -42,7 +42,9 @@ describe('worker setPassword()', () => {
await tx.rollback();
} catch (e) {
expect(e.message).toEqual(`This password can only be changed by the user themselves`);
expect(e.message).toEqual(
'Through this procedure, it is not possible to modify the password of users with verified email'
);
await tx.rollback();
}
});

View File

@ -11,7 +11,7 @@
? 'Click to allow the user to be disabled'
: 'Click to exclude the user from getting disabled'}}
</vn-item>
<vn-item ng-if="!$ctrl.worker.user.emailVerified && $ctrl.vnConfig.storage.currentUserWorkerId !=$ctrl.worker.id" ng-click="setPassword.show()" translate>
<vn-item ng-click="setPassword.show()" translate>
Change password
</vn-item>
</slot-menu>