setNewAuthCredentials() method
This commit is contained in:
parent
a9490d8fd2
commit
edcee5eb6a
19
core/user.js
19
core/user.js
|
@ -375,6 +375,25 @@ User.prototype.persistAllProperties = function(cb) {
|
|||
*/
|
||||
};
|
||||
|
||||
User.prototype.setNewAuthCredentials = function(password, cb) {
|
||||
var self = this;
|
||||
|
||||
generatePasswordDerivedKeyAndSalt(password, function dkAndSalt(err, info) {
|
||||
if(err) {
|
||||
cb(err);
|
||||
} else {
|
||||
var newProperties = {
|
||||
pw_pbkdf2_salt : info.salt,
|
||||
pw_pbkdf2_dk : info.dk,
|
||||
};
|
||||
|
||||
self.persistProperties(newProperties, function persisted(err) {
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
User.prototype.getAge = function() {
|
||||
if(_.has(this.properties, 'birthdate')) {
|
||||
return moment().diff(this.properties.birthdate, 'years');
|
||||
|
|
Loading…
Reference in New Issue