Fixed a returnTo bug
Bumped version to 2.1.4
This commit is contained in:
@ -4,7 +4,7 @@ Hackathon Starter [
|
||||
Jump to [What's new in 2.1.4?](#changelog)
|
||||
|
||||
A boilerplate for **Node.js** web applications.
|
||||
|
||||
@ -1134,6 +1134,10 @@ Add this to `package.json`, after *name* and *version*. This is necessary becaus
|
||||
Changelog
|
||||
---------
|
||||
|
||||
### 2.1.4 (June 5, 2014)
|
||||
- Fixed a bug related to `returnTo` url (#155)
|
||||
|
||||
|
||||
### 2.1.3 (June 3, 2014)
|
||||
- Font Awesome 4.1
|
||||
- Updated icons on some API examples
|
||||
|
12
app.js
12
app.js
@ -90,21 +90,21 @@ app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
app.use(flash());
|
||||
app.use(function(req, res, next) {
|
||||
// CSRF
|
||||
// CSRF protection.
|
||||
if (whitelist.indexOf(req.path) !== -1) next();
|
||||
else csrf(req, res, next);
|
||||
});
|
||||
app.use(function(req, res, next) {
|
||||
// Make current user available in templates
|
||||
// Make user object available in templates.
|
||||
res.locals.user = req.user;
|
||||
next();
|
||||
});
|
||||
app.use(function(req, res, next) {
|
||||
// Keep track of the previous URL so a user can redirect
|
||||
// back to the original destination after a successful login.
|
||||
if (req.method !== 'GET') return next();
|
||||
// Remember original destination before login.
|
||||
var path = req.path.split('/')[1];
|
||||
if (/(auth|login|logout|signup)$/i.test(path)) return next();
|
||||
if (/auth|login|logout|signup|img|fonts|favicon/i.test(path)) {
|
||||
return next();
|
||||
}
|
||||
req.session.returnTo = req.path;
|
||||
next();
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hackathon-starter",
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.4",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sahat/hackathon-starter.git"
|
||||
|
Reference in New Issue
Block a user