Last active
August 29, 2015 14:18
-
-
Save StudioLE/53f968bd5ea39e32cf2a to your computer and use it in GitHub Desktop.
Register a new using Sails.js + Waterlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When pull request #41 is merged loginSuccess can automatically return a JSON Web Token as a response to successful registration.