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:
parent
f1248b67f4
commit
9f72b324fa
3 changed files with 47 additions and 7 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue