actually call the correct function

This commit is contained in:
Eduardo Quiros 2022-09-01 02:59:41 -06:00
parent da8c57e369
commit 030cc74b5f
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
3 changed files with 22 additions and 9 deletions

View File

@ -248,7 +248,7 @@ export class AppController {
@Body('community_id') community_id: string,
@Body('number_house') number_house: string,
) {
return this.appService.updateUser(
return this.appService.resetUserPassword(
id,
dni,
name,

View File

@ -176,7 +176,7 @@ export class AppService {
.pipe(map((message: string) => ({ message })));
}
async updateTenant(
_id: string,
dni: string,
@ -255,14 +255,27 @@ export class AppService {
.pipe(map((message: string) => ({ message })));
}
resetUserPassword(id: string, dni: string, name: string, last_name: string, email: string, phone: number
, user_type: string, status: string, date_entry: Date, community_id: string) {
resetUserPassword(
id: string,
dni: string,
name: string,
last_name: string,
email: string,
phone: number,
_password: string,
user_type: string,
status: string,
date_entry: Date,
community_id: string,
number_house: string,
) {
const pattern = { cmd: 'resetUserPassword' };
const payload = {
id: id, dni: dni, name: name, last_name: last_name, email: email, phone: phone,
password: this.generatePassword(), user_type: user_type, status: status, date_entry: date_entry, community_id
password: this.generatePassword(), user_type: user_type, status: status, date_entry: date_entry, community_id: community_id, number_house: number_house
};
console.log(payload);
return this.clientUserApp
.send<string>(pattern, payload)
.pipe(

View File

@ -73,15 +73,15 @@ export class UsersService {
}
async resetUserPassword(user: UserDocument) {
const password = user.password;
const passwordEncriptada = Md5.init(password);
const unencryptedPassword = user.password;
const passwordEncriptada = Md5.init(user.password);
user.password = passwordEncriptada;
this.userModel.findOneAndUpdate({ _id: user._id }, { password: passwordEncriptada }, {
this.userModel.findOneAndUpdate({ _id: user._id }, user, {
new: true,
});
const pattern = { cmd: 'emailResetUserPassword' };
const payload = {
email: user['email'], password: user['password'],
email: user['email'], password: unencryptedPassword,
date_entry: user['date_entry'], community_name: user['community_id']
};
return this.clientNotificationtApp