trailsjs / sails-auth

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
https://www.npmjs.org/package/sails-auth
MIT License
265 stars 141 forks source link

Action Login issue #106

Open fubaydullaev opened 8 years ago

fubaydullaev commented 8 years ago

Hi guys !

I wonder when action becomes "login" as it sends me undefined all the time ?

var action = req.param('action');

if (action === 'register') {
  res.redirect('/register');
}
else if (action === 'login') {
  res.redirect('/login');
}
else if (action === 'disconnect') {
  res.redirect('back');
}
else {
  // make sure the server always returns a response to the client
  // i.e passport-local bad username/email or password
  res.forbidden();
}

And this logic works in sails-generate-auth and it's a bit different:

switch (action) {
  case 'register':
    res.redirect('/register');
    break;
  case 'disconnect':
    res.redirect('back');
    break;
  default:
    res.redirect('/login');
}