1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Server: encrypt password in database

This commit is contained in:
Chocobozzz 2016-08-25 17:57:37 +02:00
parent f84a89f0e7
commit 26d7d31ba3
6 changed files with 74 additions and 15 deletions

View file

@ -41,7 +41,22 @@ function getRefreshToken (refreshToken, callback) {
function getUser (username, password) {
logger.debug('Getting User (username: ' + username + ', password: ' + password + ').')
return User.getByUsernameAndPassword(username, password)
return User.getByUsername(username).then(function (user) {
if (!user) return null
// We need to return a promise
return new Promise(function (resolve, reject) {
return user.isPasswordMatch(password, function (err, isPasswordMatch) {
if (err) return reject(err)
if (isPasswordMatch === true) {
return resolve(user)
}
return resolve(null)
})
})
})
}
function revokeToken (token) {