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",

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>