Implémentation SkydiverId API

This commit is contained in:
Rampeur
2024-05-08 20:37:33 +02:00
parent eb64f2c411
commit a4d2b76bc5
43 changed files with 2772 additions and 1267 deletions
+3 -3
View File
@@ -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({