mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-29 17:26:26 -05:00
22 lines
559 B
JavaScript
22 lines
559 B
JavaScript
|
const { BeanModel } = require("redbean-node/dist/bean-model");
|
||
|
const passwordHash = require("../password-hash");
|
||
|
const { R } = require("redbean-node");
|
||
|
|
||
|
class User extends BeanModel {
|
||
|
|
||
|
/**
|
||
|
* Direct execute, no need R.store()
|
||
|
* @param newPassword
|
||
|
* @returns {Promise<void>}
|
||
|
*/
|
||
|
async resetPassword(newPassword) {
|
||
|
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
|
||
|
passwordHash.generate(newPassword),
|
||
|
this.id
|
||
|
]);
|
||
|
this.password = newPassword;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = User;
|