Implémentation SkydiverId API
This commit is contained in:
@@ -24,7 +24,7 @@ var UserSchema = new mongoose.Schema({
|
||||
UserSchema.plugin(uniqueValidator, { message: 'is already taken.' });
|
||||
|
||||
UserSchema.methods.validPassword = function (password) {
|
||||
var hash = crypto.pbkdf2Sync(password, this.salt, 10000, 512, 'sha512').toString('hex');
|
||||
let hash = crypto.pbkdf2Sync(password, this.salt, 10000, 512, 'sha512').toString('hex');
|
||||
return this.hash === hash;
|
||||
};
|
||||
|
||||
@@ -34,8 +34,8 @@ UserSchema.methods.setPassword = function (password) {
|
||||
};
|
||||
|
||||
UserSchema.methods.generateJWT = function () {
|
||||
var today = new Date();
|
||||
var exp = new Date(today);
|
||||
let today = new Date();
|
||||
let exp = new Date(today);
|
||||
exp.setDate(today.getDate() + 60);
|
||||
|
||||
return jwt.sign({
|
||||
|
||||
Reference in New Issue
Block a user