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:
parent
f84a89f0e7
commit
26d7d31ba3
6 changed files with 74 additions and 15 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue