|
@ -667,6 +667,25 @@ class UserService extends SiteService { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async updatePassword (user, password) { |
|
|
|
|
|
const { crypto: cryptoService } = this.dtp.services; |
|
|
|
|
|
|
|
|
|
|
|
const passwordSalt = uuidv4(); |
|
|
|
|
|
const passwordHash = cryptoService.maskPassword(passwordSalt, password); |
|
|
|
|
|
|
|
|
|
|
|
this.log.info('updating user password', { userId: user._id }); |
|
|
|
|
|
|
|
|
|
|
|
await User.updateOne( |
|
|
|
|
|
{ _id: user._id }, |
|
|
|
|
|
{ |
|
|
|
|
|
$set: { |
|
|
|
|
|
passwordSalt: passwordSalt, |
|
|
|
|
|
password: passwordHash, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Updates the `lastAnnouncement` field of a User to the `created` date of the |
|
|
* Updates the `lastAnnouncement` field of a User to the `created` date of the |
|
|
* specified announcement (for tracking last-seen announcements). |
|
|
* specified announcement (for tracking last-seen announcements). |
|
|