Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "darklord", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"author": "Gregory Pratt <gregory.pratt@me.com> (http://grumpywizards.com)", | ||
@@ -19,2 +19,3 @@ "description": "Stateless JWT based authentication", | ||
"scripts": { | ||
"start": "node ./app.js", | ||
"lint": "jshint . --exclude-path=.gitignore" | ||
@@ -21,0 +22,0 @@ }, |
@@ -15,15 +15,14 @@ var passport = require('passport'); | ||
var secret = opts.secret || process.env.JWT_SECRET; | ||
if (!opts.user) { | ||
// If no user provided create passport strategy | ||
passport.use(User.createStrategy()); | ||
passport.serializeUser(User.serializeUser()); | ||
passport.deserializeUser(User.deserializeUser()); | ||
} | ||
function register(req, res) { | ||
var user = new User({ | ||
// let's assume passport is used always | ||
passport.use(User.createStrategy()); | ||
passport.serializeUser(User.serializeUser()); | ||
passport.deserializeUser(User.deserializeUser()); | ||
function register(req, res, next) { | ||
User.register({ | ||
email: req.body.email, | ||
verifyToken: uuid.v4() | ||
}); | ||
User.register(user, req.body.password, function (err) { | ||
verifyToken: uuid.v4(), | ||
}, req.body.password, function (err) { | ||
console.log('ok', err); | ||
if (err) { | ||
@@ -34,3 +33,3 @@ res.status(400).send({ error: err }); | ||
// TODO: send verification email | ||
authenticate(req, res); | ||
authenticate(req, res, next); | ||
} | ||
@@ -40,3 +39,3 @@ }); | ||
function authenticate(req, res) { | ||
function authenticate(req, res, next) { | ||
passport.authenticate('local', { session: false }, function (err, user) { | ||
@@ -50,3 +49,3 @@ if (err) { | ||
} | ||
})(req, res); | ||
})(req, res, next); | ||
} | ||
@@ -53,0 +52,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14828
351