This commit is contained in:
NyxiumYuuki 2021-05-31 23:09:58 +02:00
parent 67a37d16ec
commit c5406006da
8 changed files with 74 additions and 10 deletions

View file

@ -42,3 +42,17 @@ function getUsersQuery(username){
}
module.exports.getUsersQuery = getUsersQuery
function changePasswordQuery(login, password, newPassword){
return new Promise((resolve, reject) => {
mongoDB.collection(config.mongodbUtilisateurs).findOneAndUpdate(
{'login': login, 'password': password},
{$set: { 'login': login, 'password': newPassword}}
,function(err,res){
if(res !== undefined){
console.log(res);
resolve(res.lastErrorObject.n === 1);
}
});
});
}
module.exports.changePasswordQuery = changePasswordQuery;