Skip to content

Commit e03383a

Browse files
committed
feat: 🎸 Password update feature added to the UsersDb.set
1 parent 7edf172 commit e03383a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/node/db/users.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,15 @@ export class UsersDb {
131131
* Updates the record of the user in the storage
132132
*
133133
* @param {User} user The user object
134+
* @param {string} [password] The new password of the user
134135
* @returns {Promise<void>}
135136
* @memberof UsersDb
136137
*/
137-
async set(user: User): Promise<void> {
138+
async set(user: User, password?: string): Promise<void> {
139+
if (password) {
140+
user.hashedPassword = await UsersDb.hashPassword(password);
141+
}
142+
138143
await this.storage.set<User>(`${this.prefix}${user.login}`, user);
139144
}
140145

0 commit comments

Comments
 (0)