my nvim and vscode are finally using the same settings

This commit is contained in:
waveringana 2024-01-25 13:03:29 -05:00
parent 58077a5d63
commit a5e03facbe
11 changed files with 757 additions and 757 deletions

View file

@ -6,24 +6,24 @@ import {createUser} from "../lib/db";
const router: Router = express.Router();
/**Middleware to check if a user is actually signed in */
const adminCheck: Middleware = (req: Request, res: Response, next: NextFunction) => {
if (!req.user)
return res.status(403).send("You are not authorized to perform this action");
else {
if (req.user.username != "admin")
return res.status(403).send("You are not authorized to perform this action");
}
if (!req.user)
return res.status(403).send("You are not authorized to perform this action");
else {
if (req.user.username != "admin")
return res.status(403).send("You are not authorized to perform this action");
}
next();
next();
};
router.get("/adduser", adminCheck, (req: Request, res: Response) => {
res.locals.filter = null;
res.render("adduser", { user: req.user });
res.locals.filter = null;
res.render("adduser", { user: req.user });
});
router.post("/adduser", adminCheck, (req: Request, res: Response) => {
createUser(req.body.username, req.body.password);
res.redirect("/");
createUser(req.body.username, req.body.password);
res.redirect("/");
});
export default router;