aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/oauth-model.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/lib/oauth-model.js b/server/lib/oauth-model.js
index d9f8b175a..6dab02fca 100644
--- a/server/lib/oauth-model.js
+++ b/server/lib/oauth-model.js
@@ -41,7 +41,22 @@ function getRefreshToken (refreshToken, callback) {
41function getUser (username, password) { 41function getUser (username, password) {
42 logger.debug('Getting User (username: ' + username + ', password: ' + password + ').') 42 logger.debug('Getting User (username: ' + username + ', password: ' + password + ').')
43 43
44 return User.getByUsernameAndPassword(username, password) 44 return User.getByUsername(username).then(function (user) {
45 if (!user) return null
46
47 // We need to return a promise
48 return new Promise(function (resolve, reject) {
49 return user.isPasswordMatch(password, function (err, isPasswordMatch) {
50 if (err) return reject(err)
51
52 if (isPasswordMatch === true) {
53 return resolve(user)
54 }
55
56 return resolve(null)
57 })
58 })
59 })
45} 60}
46 61
47function revokeToken (token) { 62function revokeToken (token) {