1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-19 13:19:42 +02:00

implement default config && move password to auth section

This commit is contained in:
Nikita Melnikov 2022-10-29 00:27:29 +03:00
parent f1248b67f4
commit 9f72b324fa
3 changed files with 47 additions and 7 deletions

View file

@ -14,14 +14,14 @@ export default async function verifyToken(req: Request, res: Response, next: Nex
const token = req.cookies.authToken;
try {
if (!appConfig.password) {
if (!appConfig.auth.password) {
res.locals.isAuthorized = false;
next();
return;
}
const decodedToken = jwt.verify(token, appConfig.password + appConfig.auth.secret);
const decodedToken = jwt.verify(token, appConfig.auth.password + appConfig.auth.secret);
res.locals.isAuthorized = !!decodedToken;