mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Server: encrypt password in database
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user