actually call the correct function
This commit is contained in:
parent
da8c57e369
commit
030cc74b5f
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue