fix administrator

This commit is contained in:
dicedtomatoreal
2020-05-04 22:01:25 -07:00
parent 20c3bf9910
commit 01bf445644
5 changed files with 13 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import { User } from "../entities/User";
export async function cookiesForAPI(req: Request, res: Response, next: any) {
if (req.cookies.typex_user) {
if (typeof req.cookies.typex_user !== 'string') return res.status(BAD_REQUEST).send({ code: BAD_REQUEST, message: "Please clear browser cookies." })
if (req.cookies.typex_user === 0) req.session.user = {
if (Number(req.cookies.typex_user) === 0) req.session.user = {
id: 0,
username: 'administrator',
password: config.administrator.password,