se agregaron funciones para actualizar usuario
This commit is contained in:
@@ -73,6 +73,20 @@ export class AuthService {
|
||||
return password;
|
||||
}
|
||||
|
||||
async update_password() {
|
||||
let user = await this.userRepo.findOne({ where: { tipoUsuario: { idTipoUsuario: 1 } } })
|
||||
|
||||
if (!user) throw new NotFoundException('No se encontró el usuario administrador.');
|
||||
const newPassword = await this.generarPassword();
|
||||
const hashedPassword = await this.encriptar(newPassword);
|
||||
user.password = hashedPassword;
|
||||
await this.userRepo.save(user);
|
||||
return newPassword;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async login(usuario: string, password: string) {
|
||||
const user = await this.userRepo.findOne({
|
||||
where: { usuario },
|
||||
|
||||
Reference in New Issue
Block a user