aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-11-09 16:25:27 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 11:07:56 +0100
commit5beb89f223539f1e415a976ff104f772526b4d20 (patch)
tree2164677d16a2965d63499e249aa75ab0e06e3a6c /server/helpers/middlewares
parentafff310e50f2fa8419bb4242470cbde46ab54463 (diff)
downloadPeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.gz
PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.zst
PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.zip
refactor scoped token service
Diffstat (limited to 'server/helpers/middlewares')
-rw-r--r--server/helpers/middlewares/accounts.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/server/helpers/middlewares/accounts.ts b/server/helpers/middlewares/accounts.ts
index 9be80167c..fa4a51e6c 100644
--- a/server/helpers/middlewares/accounts.ts
+++ b/server/helpers/middlewares/accounts.ts
@@ -28,8 +28,7 @@ async function doesAccountExist (p: Bluebird<MAccountDefault>, res: Response, se
28 if (!account) { 28 if (!account) {
29 if (sendNotFound === true) { 29 if (sendNotFound === true) {
30 res.status(404) 30 res.status(404)
31 .send({ error: 'Account not found' }) 31 .json({ error: 'Account not found' })
32 .end()
33 } 32 }
34 33
35 return false 34 return false
@@ -41,12 +40,11 @@ async function doesAccountExist (p: Bluebird<MAccountDefault>, res: Response, se
41} 40}
42 41
43async function doesUserFeedTokenCorrespond (id: number | string, token: string, res: Response) { 42async function doesUserFeedTokenCorrespond (id: number | string, token: string, res: Response) {
44 const user = await UserModel.loadById(parseInt(id + '', 10)) 43 const user = await UserModel.loadByIdWithChannels(parseInt(id + '', 10))
45 44
46 if (token !== user.feedToken) { 45 if (token !== user.feedToken) {
47 res.status(401) 46 res.status(401)
48 .send({ error: 'User and token mismatch' }) 47 .json({ error: 'User and token mismatch' })
49 .end()
50 48
51 return false 49 return false
52 } 50 }