Skip to content

Instantly share code, notes, and snippets.

@StudioLE
Last active August 29, 2015 14:18
Show Gist options
  • Save StudioLE/53f968bd5ea39e32cf2a to your computer and use it in GitHub Desktop.
Save StudioLE/53f968bd5ea39e32cf2a to your computer and use it in GitHub Desktop.
Register a new using Sails.js + Waterlock
User.create(data, function(err, user) {
if(err) {
console.log(err)
return false
}
waterlock.engine.attachAuthToUser({
email: data.email,
password: data.password
}, user, function(err, user) {
sails.log('Added user ' + user.name)
// waterlock loginSuccess will log the user in then apply the
// post login event defined in config/waterlock.js
waterlock.cycle.loginSuccess(req, res, user)
})
})
@StudioLE
Copy link
Author

When pull request #41 is merged loginSuccess can automatically return a JSON Web Token as a response to successful registration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment