1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-09 23:40:06 +00:00

chore: windows env variables needs to be trimmed

This commit is contained in:
Saad Jutt
2021-11-12 21:27:29 +05:00
parent 2eb42408d1
commit 46f2648a95
5 changed files with 5 additions and 5 deletions

View File

@@ -29,7 +29,7 @@ const authenticateToken = (
tokenType: 'accessToken' | 'refreshToken' = 'accessToken'
) => {
const { MODE } = process.env
if (MODE === 'desktop') return next()
if (MODE?.trim() === 'desktop') return next()
const authHeader = req.headers['authorization']
const token = authHeader?.split(' ')[1]

View File

@@ -1,6 +1,6 @@
export const desktopRestrict = (req: any, res: any, next: any) => {
const { MODE } = process.env
if (MODE === 'desktop')
if (MODE?.trim() === 'desktop')
return res.status(403).send('Not Allowed while in Desktop Mode.')
next()

View File

@@ -1,6 +1,6 @@
export const verifyAdmin = (req: any, res: any, next: any) => {
const { MODE } = process.env
if (MODE === 'desktop') return next()
if (MODE?.trim() === 'desktop') return next()
const { user } = req
if (!user?.isAdmin) return res.status(401).send('Admin account required')