mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:19:26 +00:00
Implemented User.changePassword
This commit is contained in:
12
lib/User.js
12
lib/User.js
@@ -66,8 +66,18 @@ class User {
|
|||||||
return await bcrypt.compare(password, this.password);
|
return await bcrypt.compare(password, this.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
changePassword(password) {
|
async changePassword(password) {
|
||||||
|
const newPassword = await User.hashPassword(password);
|
||||||
|
|
||||||
|
const conn = await new DatabaseConnectionPool();
|
||||||
|
|
||||||
|
const sql = `
|
||||||
|
update ${this.type}
|
||||||
|
set password = ?
|
||||||
|
where ${this.type}Id = ?;
|
||||||
|
`;
|
||||||
|
|
||||||
|
await conn.runQuery(sql, [ newPassword, this.id ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPasswordReset() {
|
getPasswordReset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user