SAML; Dashboard
This commit is contained in:
24
app/models/auth/PasswordReset.model.js
Normal file
24
app/models/auth/PasswordReset.model.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { Model } = require('flitter-orm')
|
||||
const bcrypt = require('bcrypt')
|
||||
|
||||
class PasswordResetModel extends Model {
|
||||
static get schema() {
|
||||
return {
|
||||
reset_on: { type: Date, default: () => new Date },
|
||||
old_hash: String,
|
||||
hash: String,
|
||||
reason: { type: String, default: 'user' }, // 'user' | 'lockout'
|
||||
}
|
||||
}
|
||||
|
||||
async set_hash(password) {
|
||||
this.hash = await bcrypt.hash(password, 10)
|
||||
return this
|
||||
}
|
||||
|
||||
async check(password) {
|
||||
return await bcrypt.compare(password, this.hash)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = PasswordResetModel
|
||||
Reference in New Issue
Block a user