mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Removed unused password logic from Member model
no-issue
This commit is contained in:
parent
aa7f9ddbeb
commit
e078cb5612
1 changed files with 1 additions and 27 deletions
|
@ -1,33 +1,7 @@
|
|||
const ghostBookshelf = require('./base');
|
||||
const security = require('../lib/security');
|
||||
|
||||
const Member = ghostBookshelf.Model.extend({
|
||||
tableName: 'members',
|
||||
|
||||
onSaving() {
|
||||
ghostBookshelf.Model.prototype.onSaving.apply(this, arguments);
|
||||
|
||||
if (this.hasChanged('password')) {
|
||||
return security.password.hash(String(this.get('password')))
|
||||
.then((hash) => {
|
||||
this.set('password', hash);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
comparePassword(rawPassword) {
|
||||
return security.password.compare(rawPassword, this.get('password'));
|
||||
},
|
||||
|
||||
toJSON(unfilteredOptions) {
|
||||
var options = Member.filterOptions(unfilteredOptions, 'toJSON'),
|
||||
attrs = ghostBookshelf.Model.prototype.toJSON.call(this, options);
|
||||
|
||||
// remove password hash and tokens for security reasons
|
||||
delete attrs.password;
|
||||
|
||||
return attrs;
|
||||
}
|
||||
tableName: 'members'
|
||||
});
|
||||
|
||||
const Members = ghostBookshelf.Collection.extend({
|
||||
|
|
Loading…
Add table
Reference in a new issue