aboutsummaryrefslogtreecommitdiffstats
path: root/app.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-08-23 19:04:14 -0700
committerAdam Soltys <[email protected]>2014-08-23 19:04:14 -0700
commitaffe228986f76b06aa96b3789852a01f8a950644 (patch)
tree77167a378a23c5eb3154c9b1e1b30f2b24ceb1ae /app.js
parentbba3ba38ec86ea98a456f56c596c9f8006e7516b (diff)
downloadcoinos-server-affe228986f76b06aa96b3789852a01f8a950644.tar.gz
coinos-server-affe228986f76b06aa96b3789852a01f8a950644.zip
Direct to originally requested page after authorization
Diffstat (limited to 'app.js')
-rw-r--r--app.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/app.js b/app.js
index 74e8611d..e5fa6f70 100644
--- a/app.js
+++ b/app.js
@@ -77,11 +77,14 @@
if (req.params.user === ((_ref = req.user) != null ? _ref.username : void 0) || ((_ref1 = req.user) != null ? _ref1.username : void 0) === 'admin') {
return next();
}
+ req.session.redirect = req.path;
return res.redirect('/login');
};
cache = function(req, res, next) {
- res.setHeader("Cache-Control", "public, max-age=900");
+ if (req.path !== '/login') {
+ res.setHeader("Cache-Control", "public, max-age=900");
+ }
return next();
};
@@ -122,7 +125,7 @@
app.post('/users', users.create);
- app.get('/:user/edit', authorize, cache, users.edit);
+ app.get('/:user/edit', authorize, users.edit);
app.post('/:user', authorize, users.update);
@@ -130,7 +133,7 @@
app.post('/:user/transactions', transactions.create);
- app.get('/:user/report', authorize, cache, transactions.index);
+ app.get('/:user/report', authorize, transactions.index);
app.get('/:user.json', users.json);