aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.coffee
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 /src/app.coffee
parentbba3ba38ec86ea98a456f56c596c9f8006e7516b (diff)
downloadcoinos-server-affe228986f76b06aa96b3789852a01f8a950644.tar.gz
coinos-server-affe228986f76b06aa96b3789852a01f8a950644.zip
Direct to originally requested page after authorization
Diffstat (limited to 'src/app.coffee')
-rw-r--r--src/app.coffee9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/app.coffee b/src/app.coffee
index a0ac6334..4198754c 100644
--- a/src/app.coffee
+++ b/src/app.coffee
@@ -34,10 +34,13 @@ authorize = (req, res, next) ->
if req.params.user is req.user?.username or
req.user?.username is 'admin'
return next()
+
+ req.session.redirect = req.path
res.redirect('/login')
cache = (req, res, next) ->
- res.setHeader "Cache-Control", "public, max-age=900"
+ unless req.path is '/login'
+ res.setHeader "Cache-Control", "public, max-age=900"
next()
fetchRates = ->
@@ -69,12 +72,12 @@ app.get('/logout', sessions.destroy)
app.get('/users/new', cache, users.new)
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)
app.get('/:user/transactions.json', authorize, transactions.json)
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)
app.get('/:user', cache, users.show)