diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-11-09 16:25:27 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 11:07:56 +0100 |
commit | 5beb89f223539f1e415a976ff104f772526b4d20 (patch) | |
tree | 2164677d16a2965d63499e249aa75ab0e06e3a6c /server/middlewares | |
parent | afff310e50f2fa8419bb4242470cbde46ab54463 (diff) | |
download | PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.gz PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.zst PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.zip |
refactor scoped token service
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/feeds.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 5c76a679f..35080ffca 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -64,8 +64,8 @@ const videoFeedsValidator = [ | |||
64 | ] | 64 | ] |
65 | 65 | ||
66 | const videoSubscriptonFeedsValidator = [ | 66 | const videoSubscriptonFeedsValidator = [ |
67 | query('accountId').optional().custom(isIdValid), | 67 | query('accountId').custom(isIdValid), |
68 | query('token').optional(), | 68 | query('token'), |
69 | 69 | ||
70 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 70 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
71 | logger.debug('Checking feeds parameters', { parameters: req.query }) | 71 | logger.debug('Checking feeds parameters', { parameters: req.query }) |
@@ -74,6 +74,7 @@ const videoSubscriptonFeedsValidator = [ | |||
74 | 74 | ||
75 | // a token alone is erroneous | 75 | // a token alone is erroneous |
76 | if (req.query.token && !req.query.accountId) return | 76 | if (req.query.token && !req.query.accountId) return |
77 | if (req.query.accountId && !await doesAccountIdExist(req.query.accountId, res)) return | ||
77 | if (req.query.token && !await doesUserFeedTokenCorrespond(res.locals.account.userId, req.query.token, res)) return | 78 | if (req.query.token && !await doesUserFeedTokenCorrespond(res.locals.account.userId, req.query.token, res)) return |
78 | 79 | ||
79 | return next() | 80 | return next() |