exports.ChangePassword = function (user,userPasswords) {
User
.findOne({name:user})
.then(function (doc) {
if (hash(userPasswords.old = doc.password)){
User.update({name:doc.name},{$set:{password:userPasswords.new}})
}
})
};
function hash(text) {
return crypto.createHash('sha1')
.update(text).digest('base64')
}