From d13bdb5dd13b1ec2f0730046e22258e2e3e4c253 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Tue, 23 Aug 2022 21:49:00 -0600 Subject: [PATCH] add reset function to user service --- servicio-usuarios/src/users/users.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servicio-usuarios/src/users/users.service.ts b/servicio-usuarios/src/users/users.service.ts index 1393b2bd..4a9c2441 100644 --- a/servicio-usuarios/src/users/users.service.ts +++ b/servicio-usuarios/src/users/users.service.ts @@ -72,6 +72,14 @@ export class UsersService { ); } + async resetUserPassword(user: UserDocument){ + let passwordEncriptada = Md5.init(user.password); + user.password = passwordEncriptada; + return this.userModel.findOneAndUpdate({ _id: user._id }, { password: passwordEncriptada }, { + new: true, + }); + } + async findCommunity(community_id: string) { const pattern = { cmd: 'findOneCommunity' } const payload = { _id: community_id }