added password change

This commit is contained in:
arnaucode
2017-07-25 22:53:45 +02:00
parent 73c386ff7f
commit b8c9d0c459
3 changed files with 17 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ var notificationModel = mongoose.model('notificationModel');
var travelModel = mongoose.model('travelModel');
var config = require('../config');
var pageSize=config.pageSize;
var pageSize = config.pageSize;
/* */
var jwt = require('jsonwebtoken'); // used to create, sign, and verify tokens
@@ -24,7 +24,8 @@ function getRand(min, max) {
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
}
function getAvatar(n){
function getAvatar(n) {
switch (n) {
case 1:
avatar = "img/avatars/racoon.png";
@@ -573,3 +574,13 @@ exports.doUnfav = function(req, res) {
});
});
};
exports.changePassword = function(req, res) {
//if(req.body.)
userModel.update({
'token': req.headers['x-access-token']
}, req.body,
function(err) {
if (err) return console.log(err);
exports.getUserByToken(req, res);
});
};