diff options
Diffstat (limited to 'server/lib/oauth-model.ts')
-rw-r--r-- | server/lib/oauth-model.ts | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index 7cf42e94c..f34c9c667 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts | |||
@@ -30,17 +30,10 @@ function getUser (username: string, password: string) { | |||
30 | return db.User.getByUsername(username).then(function (user) { | 30 | return db.User.getByUsername(username).then(function (user) { |
31 | if (!user) return null | 31 | if (!user) return null |
32 | 32 | ||
33 | // We need to return a promise | 33 | return user.isPasswordMatch(password).then(passwordMatch => { |
34 | return new Promise(function (resolve, reject) { | 34 | if (passwordMatch === false) return null |
35 | return user.isPasswordMatch(password, function (err, isPasswordMatch) { | ||
36 | if (err) return reject(err) | ||
37 | 35 | ||
38 | if (isPasswordMatch === true) { | 36 | return user |
39 | return resolve(user) | ||
40 | } | ||
41 | |||
42 | return resolve(null) | ||
43 | }) | ||
44 | }) | 37 | }) |
45 | }) | 38 | }) |
46 | } | 39 | } |
@@ -80,8 +73,6 @@ function saveToken (token: TokenInfo, client: OAuthClientInstance, user: UserIns | |||
80 | tokenCreated.user = user | 73 | tokenCreated.user = user |
81 | 74 | ||
82 | return tokenCreated | 75 | return tokenCreated |
83 | }).catch(function (err) { | ||
84 | throw err | ||
85 | }) | 76 | }) |
86 | } | 77 | } |
87 | 78 | ||