-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
381 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ API_SECRET=veryveryverysecretapikey | |
DEBUG=false | ||
MAIL_PORT=25 | ||
MAIL_HOST=localhost | ||
MAIL_FROM='Lednice IT<[email protected]>' | ||
MAIL_FROM=Lednice IT | ||
MAIL_USERNAME=[email protected] | ||
MAIL_PASSWORD=somerandompassword | ||
MAIL_SYSTEM=[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
module.exports = { | ||
// Checks if user is not a kiosk user, if kiosk, redirect to kiosk page. | ||
checkKiosk: function (req, res, next) { | ||
if (!req.user) { | ||
return next() | ||
} | ||
if (!req.user.kiosk) { | ||
return next() | ||
} | ||
res.redirect('/kiosk_keypad') | ||
export function checkKiosk(req, res, next) { | ||
if (!req.user) { | ||
return next() | ||
} | ||
if (!req.user.kiosk) { | ||
return next() | ||
} | ||
res.redirect('/kiosk_keypad') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
module.exports = { | ||
// Uses passport functionality, which checks if user is logged in. If not, redirects to login page. | ||
ensureAuthenticated: function (req, res, next) { | ||
if (req.isAuthenticated()) { | ||
return next() | ||
} | ||
console.log('redirecting') | ||
res.redirect('/login') | ||
export function ensureAuthenticated(req, res, next) { | ||
if (req.isAuthenticated()) { | ||
return next() | ||
} | ||
console.log('redirecting') | ||
res.redirect('/login') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
var responseJson | ||
|
||
module.exports = { | ||
// Checks if request contains expected API secret. If it does, proceed without problem, otherwise respond with error JSON. | ||
ensureAuthenticatedAPI: function (req, res, next) { | ||
// Check if request header contains API secret key | ||
if (req.get('sbf-API-secret') !== process.env.API_SECRET) { | ||
res.status(401) | ||
res.set('Content-Type', 'application/problem+json') | ||
responseJson = { | ||
type: 'https://github.com/houby-studio/small-business-fridge/wiki/API-documentation#api-protection', | ||
title: 'Your request does not contain secret key.', | ||
status: 401, | ||
'detail:': | ||
'This is not a public function. To use this API, you need to supply secret key in the header. More details can be found in documentation https://git.io/Jeodr' | ||
} | ||
res.json(responseJson) | ||
return | ||
export function ensureAuthenticatedAPI(req, res, next) { | ||
// Check if request header contains API secret key | ||
if (req.get('sbf-API-secret') !== process.env.API_SECRET) { | ||
res.status(401) | ||
res.set('Content-Type', 'application/problem+json') | ||
responseJson = { | ||
type: 'https://github.com/houby-studio/small-business-fridge/wiki/API-documentation#api-protection', | ||
title: 'Your request does not contain secret key.', | ||
status: 401, | ||
'detail:': | ||
'This is not a public function. To use this API, you need to supply secret key in the header. More details can be found in documentation https://git.io/Jeodr' | ||
} | ||
return next() | ||
res.json(responseJson) | ||
return | ||
} | ||
return next() | ||
} |
Oops, something went wrong.