aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-27 21:15:07 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-27 21:16:19 +0200
commit32bb41560279dd0c75d0461f081873483e3aaed9 (patch)
treeef4d621d7f9f5ffcadf437da0e872042312305bc /server/models/oauth-token.js
parentf24c4e44624058e16d4a09856fac8c409203c59f (diff)
downloadPeerTube-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.js6
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
30function getByRefreshTokenAndPopulateClient (refreshToken) { 30function 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
49function getByTokenAndPopulateUser (bearerToken) { 49function getByTokenAndPopulateUser (bearerToken) {
50 return this.findOne({ accessToken: bearerToken }).populate('user') 50 return this.findOne({ accessToken: bearerToken }).populate('user').exec()
51} 51}
52 52
53function getByRefreshToken (refreshToken) { 53function getByRefreshToken (refreshToken) {
54 return this.findOne({ refreshToken: refreshToken }) 54 return this.findOne({ refreshToken: refreshToken }).exec()
55} 55}