diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-17 03:24:53 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-17 03:24:53 +0200 |
| commit | 6eceaa562b5752ec884c15466241228db3955dc8 (patch) | |
| tree | 87791a1821144388f966ae16235a639c528b2b30 /app/server | |
| parent | a70df1505e8d4dfbb7540b6e3d5ffe5da2f9609c (diff) | |
ughhhhhhhg
Diffstat (limited to 'app/server')
| -rw-r--r-- | app/server/util/auth.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/server/util/auth.js b/app/server/util/auth.js index 1515bb4..6a9bfe0 100644 --- a/app/server/util/auth.js +++ b/app/server/util/auth.js @@ -24,7 +24,7 @@ export function route(app, serve_index){ passport.authenticate("local"), login) app.put("/api/checkin", - ensureAuthenticated, + ensureAPIAuthenticated, checkin) } @@ -36,6 +36,13 @@ export function ensureAuthenticated(req, res, next) { next() } +export function ensureAPIAuthenticated(req, res, next) { + if (!req.isAuthenticated()) { + return res.send(500) + } + next() +} + export function getUserByUsername(username) { return userModel.show(sanitizeName(username), 'username') } |
