From 89ea931d9c964e553d332c4b67e8891dd5baf515 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 17 Jun 2024 12:19:59 +0200 Subject: [PATCH 1/2] feat: refs #6744 add locale & drop verification --- loopback/locale/es.json | 6 +++--- modules/account/back/models/account.js | 6 +++++- modules/worker/front/descriptor/index.html | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e876c1bbb..188f33631 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -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" -} +} \ No newline at end of file diff --git a/modules/account/back/models/account.js b/modules/account/back/models/account.js index ceb26053c..7800d3e44 100644 --- a/modules/account/back/models/account.js +++ b/modules/account/back/models/account.js @@ -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); }; diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 73332efac..a77f986ed 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -11,7 +11,7 @@ ? 'Click to allow the user to be disabled' : 'Click to exclude the user from getting disabled'}} - + Change password From 4bc62a30bdb8a2e3e530de88cabea13918e77d53 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 17 Jun 2024 12:23:01 +0200 Subject: [PATCH 2/2] fix: refs #6744 back test --- modules/worker/back/methods/worker/specs/setPassword.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/specs/setPassword.spec.js b/modules/worker/back/methods/worker/specs/setPassword.spec.js index 8d152bdd1..b9b20ce94 100644 --- a/modules/worker/back/methods/worker/specs/setPassword.spec.js +++ b/modules/worker/back/methods/worker/specs/setPassword.spec.js @@ -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(); } });