mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 13:19:42 +02:00
Implement yaml config (#271)
This commit is contained in:
parent
5a7f1c843b
commit
13762096c4
20 changed files with 164 additions and 479 deletions
|
@ -1,6 +1,6 @@
|
|||
import config from 'config';
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import appConfig from "../../utils/appConfig.js";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -14,14 +14,14 @@ export default async function verifyToken(req: Request, res: Response, next: Nex
|
|||
const token = req.cookies.authToken;
|
||||
|
||||
try {
|
||||
if (!process.env.PASSWORD) {
|
||||
if (!appConfig.password) {
|
||||
res.locals.isAuthorized = false;
|
||||
next();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const decodedToken = jwt.verify(token, process.env.PASSWORD + config.get('secret'));
|
||||
const decodedToken = jwt.verify(token, appConfig.password + appConfig.auth.secret);
|
||||
|
||||
res.locals.isAuthorized = !!decodedToken;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue