These are chat archives for waterlock/waterlock

16th
Mar 2015
Aaron Heesakkers
@aars
Mar 16 2015 10:21
Hi. I just set up SailsJS for use with EmberJS, using sails-generate-ember-blueprints, and waterlock + waterlock-local-auth. When POSTing to the login route my Sails application dies with the "'Can\'t set headers after they are sent.'"
Invalid attributes sent to Auth:
 • password
   • "minLength" validation rule failed for input: 'test'

debug: user login failure
_http_outgoing.js:335
    throw new Error('Can\'t set headers after they are sent.');
I haven't done any customization.. Where should I look? Any clues?
I think the issue is on line 18 of waterlock-local-auth/lib/controllers/actions/login.js.
if (err) {
  res.serverError(err);
}
Should probably be:
if (err) {
  return res.serverError(err);
}
Aaron Heesakkers
@aars
Mar 16 2015 10:27
I'm also wondering why the login-action does any input validation like string-length on password. And worse, give a default error message that the password doesn't match some rule. Why is this default behaviour? How can I disable it easily?
Aaron Heesakkers
@aars
Mar 16 2015 10:36
waterlock/waterlock-local-auth#28
Aaron Heesakkers
@aars
Mar 16 2015 10:48
Ah, at least NODE_ENV=production will hide these error messages (about the password length). But it will become a 500 message. Odd behaviour.