app.configure(function(){app.use(express.bodyParser());app.use(form({ keepExtensions: true }));});
app.post('/admin/account', loadUser, requireLogin, restrictToSelf, admin.account_update);
exports.restrictToSelf = function (req, res, next) {Account.findOne({ "users.email" : req.current_user.email }, function(err, account) {if (account && account.subdomain == req.headers.host) {next();} else {req.flash('error', 'You are not authorized to access that page');res.redirect('back');}});}
// controller.jsexports.account_update = function(req, res, next) {req.form.complete(function(err, fields, files){// do some upload stuff hereres.redirect('back');});};
--
You received this message because you are subscribed to the Google Groups "Express" group.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.
On Monday, July 25, 2011 at 6:19 PM, Adam McDonald wrote:
Hmm, I'm having this exact same problem with the async middleware. Do you have any suggestions around it?
--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/hZVDryyTduMJ.
Thanks TJ I will take a look at that. I just didn't didn't include the middleware in that route and did the restrictToSelf logic in the request.form which is not ideal but it works.
--
Brandon Martin
Zyph | Martin Design Studios
Lead Developer
P - 509.991.7587
E - bma...@zyphmartin.com
http://zyphmartin.com
On Monday, July 25, 2011 at 7:38 PM, Adam McDonald wrote:
Hey TJ, would these modifications be to connect-form.js? I'm not positive when to call the resume() function due to the various callbacks.
--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/z9_vxJ6cLZoJ.
On Monday, July 25, 2011 at 7:53 PM, Adam McDonald wrote:
Okay. So, can you guide me in the right direction to use the pause/resume functions? I'm using async middleware to load the user and authentication, similar to @zmbartin.
--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/APtM0Xhg4T0J.