From ffbbe0d3a80837ca99b56ff9314860674a680624 Mon Sep 17 00:00:00 2001 From: lemuel Date: Thu, 11 Aug 2022 14:33:51 -0500 Subject: [PATCH] =?UTF-8?q?password=20se=20agrego=202=20caracteres=20m?= =?UTF-8?q?=C3=A1s=20a=20la=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bcrypt/bcrypt.service.ts | 4 ++-- src/usuario/usuario.service.ts | 34 +++++++++++++++------------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/bcrypt/bcrypt.service.ts b/src/bcrypt/bcrypt.service.ts index 8775cdb..4ebbb38 100644 --- a/src/bcrypt/bcrypt.service.ts +++ b/src/bcrypt/bcrypt.service.ts @@ -19,9 +19,9 @@ export class BcryptService { } generarPassword = () => { - const length = 8; + const length = 10; const charset = - 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-@#$%&=?¿*()/_-'; let password = ''; for (let i = 0; i < length; i++) diff --git a/src/usuario/usuario.service.ts b/src/usuario/usuario.service.ts index 3b492ac..1c646c0 100644 --- a/src/usuario/usuario.service.ts +++ b/src/usuario/usuario.service.ts @@ -98,10 +98,6 @@ export class UsuarioService { /* Falta conexión a soap */ if (existeUsuario.password) throw new ConflictException('Ya fue regisrado este número de cuenta.'); - // if (!existeUsuario.activo) - // throw new ConflictException( - // 'No se puede registar con este número de cuenta por que se encuentra desactivado.', - // ); return this.institucionUsuarioService.findByUsuarioInstitucionCarrera( existeUsuario, institucionCarrera, @@ -116,28 +112,28 @@ export class UsuarioService { id_institucion, 1, ); - const query = this.repository + + return this.repository .createQueryBuilder('u') .innerJoinAndSelect('u.instituciones', 'is') .innerJoinAndSelect('u.tipoUsuario', 'tu') .innerJoinAndSelect('is.institucionCarrera', 'ic') .innerJoinAndSelect('ic.carrera', 'c') .innerJoinAndSelect('ic.institucion', 'i') - .innerJoinAndSelect('c.nivel', 'n') - .where('usuario = :usuario && rfc = :rfc', { usuario, rfc }); - - return query.getOne().then((usuario) => { - if (!usuario) throw new NotFoundException('No existe este usuario.'); - if (usuario.password) - throw new ConflictException( - 'Ya fue regisrado este número de trabajador.', + .where('usuario = :usuario && rfc = :rfc', { usuario, rfc }) + .getOne() + .then((usuario) => { + if (!usuario) throw new NotFoundException('No existe este usuario.'); + if (usuario.password) + throw new ConflictException( + 'Ya fue regisrado este número de trabajador.', + ); + return this.institucionUsuarioService.findByUsuarioInstitucionCarrera( + usuario, + institucionCarrera, + 'trabajador', ); - return this.institucionUsuarioService.findByUsuarioInstitucionCarrera( - usuario, - institucionCarrera, - 'trabajador', - ); - }); + }); } async findAll(filtros: {