Parent Directory
|
Revision Log
chore: add old version archive branches (2.x to 9.x-dev)
1 | rakinar2 | 577 | import { NextFunction, Request, Response } from "express"; |
2 | import DiscordClient from "../client/Client"; | ||
3 | |||
4 | export default function auth(req: Request, res: Response, next: NextFunction) { | ||
5 | let token = req.body.token; | ||
6 | |||
7 | if (!token) | ||
8 | token = req.query.token; | ||
9 | |||
10 | if (!token || !DiscordClient.client.server.validToken(token)) { | ||
11 | res.status(401).json({ | ||
12 | status: 401, | ||
13 | message: "Unauthorized", | ||
14 | detail: "Invalid authentication credentials provided" | ||
15 | }); | ||
16 | |||
17 | return; | ||
18 | } | ||
19 | |||
20 | next(); | ||
21 | }; |
[email protected] | ViewVC Help |
Powered by ViewVC 1.1.26 |