diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-27 21:15:07 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-27 21:16:19 +0200 |
commit | 32bb41560279dd0c75d0461f081873483e3aaed9 (patch) | |
tree | ef4d621d7f9f5ffcadf437da0e872042312305bc /server/models/oauth-token.js | |
parent | f24c4e44624058e16d4a09856fac8c409203c59f (diff) | |
download | PeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.tar.gz PeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.tar.zst PeerTube-32bb41560279dd0c75d0461f081873483e3aaed9.zip |
Server: Use ES6 promise for mongoose/node-oatuh2-server
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r-- | server/models/oauth-token.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js index 23c698732..f6a814c36 100644 --- a/server/models/oauth-token.js +++ b/server/models/oauth-token.js | |||
@@ -28,7 +28,7 @@ mongoose.model('OAuthToken', OAuthTokenSchema) | |||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | function getByRefreshTokenAndPopulateClient (refreshToken) { | 30 | function getByRefreshTokenAndPopulateClient (refreshToken) { |
31 | return this.findOne({ refreshToken: refreshToken }).populate('client').then(function (token) { | 31 | return this.findOne({ refreshToken: refreshToken }).populate('client').exec().then(function (token) { |
32 | if (!token) return token | 32 | if (!token) return token |
33 | 33 | ||
34 | const tokenInfos = { | 34 | const tokenInfos = { |
@@ -47,9 +47,9 @@ function getByRefreshTokenAndPopulateClient (refreshToken) { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | function getByTokenAndPopulateUser (bearerToken) { | 49 | function getByTokenAndPopulateUser (bearerToken) { |
50 | return this.findOne({ accessToken: bearerToken }).populate('user') | 50 | return this.findOne({ accessToken: bearerToken }).populate('user').exec() |
51 | } | 51 | } |
52 | 52 | ||
53 | function getByRefreshToken (refreshToken) { | 53 | function getByRefreshToken (refreshToken) { |
54 | return this.findOne({ refreshToken: refreshToken }) | 54 | return this.findOne({ refreshToken: refreshToken }).exec() |
55 | } | 55 | } |