waterlock / waterlock-local-auth

Local authentication method for waterlock
http://waterlock.ninja/
MIT License
39 stars 83 forks source link

Error when calling /auth/register with an email already in use #54

Closed enten closed 8 years ago

enten commented 8 years ago
# First call to /auth/register
debug: user registration success
{ auth:
   { password: '******',
     email: 'steven@enten.fr',
     createdAt: '2016-02-06T00:18:19.291Z',
     updatedAt: '2016-02-06T00:18:19.314Z',
     id: 19,
     user: 18 },
  createdAt: '2016-02-06T00:18:19.308Z',
  updatedAt: '2016-02-06T00:18:19.308Z',
  id: 18 }

# Second call to /auth/register with same inputs
debug: user register failure
debug: user registration success
{ auth:
   { password: '******',
     email: 'steven@enten.fr',
     createdAt: '2016-02-06T00:18:19.291Z',
     updatedAt: '2016-02-06T00:18:19.314Z',
     id: 19 },
  createdAt: '2016-02-06T00:18:19.308Z',
  updatedAt: '2016-02-06T00:18:19.308Z',
  id: 18 }

# Error
_http_outgoing.js:344
    throw new Error('Can\'t set headers after they are sent.');
    ^

Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:344:11)
    at ServerResponse.res.setHeader (/usr/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:134:22)
    at ServerResponse.res.set.res.header (/home/steven/code/b3/b3-users/node_modules/express/lib/response.js:595:10)
    at ServerResponse.res.send (/home/steven/code/b3/b3-users/node_modules/express/lib/response.js:151:12)
    at ServerResponse.res.json (/home/steven/code/b3/b3-users/node_modules/express/lib/response.js:237:15)
    at ServerResponse.jsonx (/home/steven/code/b3/b3-users/node_modules/sails/lib/hooks/responses/index.js:218:21)
    at couldNotGuessView (/home/steven/code/b3/b3-users/api/responses/ok.js:46:16)
    at viewReady (/home/steven/code/b3/b3-users/node_modules/sails/lib/hooks/views/res.view.js:43:50)
    at viewFailedToRender (/home/steven/code/b3/b3-users/node_modules/sails/lib/hooks/views/res.view.js:276:16)
    at Function.app.render (/home/steven/code/b3/b3-users/node_modules/express/lib/application.js:552:14)
    at ServerResponse.res.render (/home/steven/code/b3/b3-users/node_modules/express/lib/response.js:845:7)
    at ServerResponse.res.view (/home/steven/code/b3/b3-users/node_modules/sails/lib/hooks/views/res.view.js:237:16)
    at ServerResponse.res.guessView (/home/steven/code/b3/b3-users/node_modules/sails/lib/hooks/views/res.view.js:38:16)
    at Object.sendOK (/home/steven/code/b3/b3-users/api/responses/ok.js:45:19)
    at ServerResponse.bound [as ok] (/home/steven/code/b3/b3-users/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
    at Object.registerSuccess (/home/steven/code/b3/b3-users/node_modules/waterlock/lib/cycle.js:75:13)
enten commented 8 years ago

I didn't see PR #52. Sorry.

bdschr commented 8 years ago

Similar bug when making a post request with not existing attribute. Crashes node.js with similar error.