diff options
Diffstat (limited to 'server/helpers/middlewares/accounts.ts')
-rw-r--r-- | server/helpers/middlewares/accounts.ts | 8 |
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 | ||
43 | async function doesUserFeedTokenCorrespond (id: number | string, token: string, res: Response) { | 42 | async 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 | } |