diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-01 09:12:02 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-01 09:12:02 +0200 |
commit | b81929a0148c8a6a3213acb41b5bd4d1936b66b5 (patch) | |
tree | 8c70b24006a778e00b51609e44c956394efa3748 /server/models/oauth-token.js | |
parent | 0eb78d530376c43d228e3e071e032fe9849149ed (diff) | |
download | PeerTube-b81929a0148c8a6a3213acb41b5bd4d1936b66b5.tar.gz PeerTube-b81929a0148c8a6a3213acb41b5bd4d1936b66b5.tar.zst PeerTube-b81929a0148c8a6a3213acb41b5bd4d1936b66b5.zip |
Server: when we remove a user, remove the oauthtokens too
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r-- | server/models/oauth-token.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js index f6a814c36..d53fdcf31 100644 --- a/server/models/oauth-token.js +++ b/server/models/oauth-token.js | |||
@@ -20,7 +20,8 @@ OAuthTokenSchema.path('user').required(true) | |||
20 | OAuthTokenSchema.statics = { | 20 | OAuthTokenSchema.statics = { |
21 | getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient, | 21 | getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient, |
22 | getByTokenAndPopulateUser: getByTokenAndPopulateUser, | 22 | getByTokenAndPopulateUser: getByTokenAndPopulateUser, |
23 | getByRefreshToken: getByRefreshToken | 23 | getByRefreshToken: getByRefreshToken, |
24 | removeByUserId: removeByUserId | ||
24 | } | 25 | } |
25 | 26 | ||
26 | mongoose.model('OAuthToken', OAuthTokenSchema) | 27 | mongoose.model('OAuthToken', OAuthTokenSchema) |
@@ -53,3 +54,7 @@ function getByTokenAndPopulateUser (bearerToken) { | |||
53 | function getByRefreshToken (refreshToken) { | 54 | function getByRefreshToken (refreshToken) { |
54 | return this.findOne({ refreshToken: refreshToken }).exec() | 55 | return this.findOne({ refreshToken: refreshToken }).exec() |
55 | } | 56 | } |
57 | |||
58 | function removeByUserId (userId, callback) { | ||
59 | return this.remove({ user: userId }, callback) | ||
60 | } | ||