mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-13 17:58:42 +03:00
This is the one.
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import CreateLogCtx from "../logger";
|
||||
|
||||
const logger = CreateLogCtx("require-logged-in.ts");
|
||||
|
||||
export function RequireLoggedIn(req: Request, res: Response, next: NextFunction) {
|
||||
if (!req.session.ktchi?.userID) {
|
||||
logger.info(`Received unauthorised request from ${req.ip} from ${req.originalUrl}`, {
|
||||
auth: req.session,
|
||||
});
|
||||
|
||||
return res.status(401).json({
|
||||
success: false,
|
||||
description: `You are not authorised to perform this action.`,
|
||||
|
||||
Reference in New Issue
Block a user