se agregaron funciones para actualizar usuario

This commit is contained in:
evenegas
2026-02-26 14:22:33 -06:00
parent 1a0af95c4e
commit c73121f7df
4 changed files with 36 additions and 2 deletions
+14
View File
@@ -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 },