Skip to content

Commit

Permalink
*fixed auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jspears committed Apr 12, 2012
1 parent a1612f6 commit 90d3d84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugins/passport/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ PassportPlugin.prototype.encryptCredentials = function (req, res, next) {
req.body[passfield] = passHash;
next();
};

PassportPlugin.prototype.onAuth = function(req,res){
res.send({
status:0,
payload:req.user
});
}
PassportPlugin.prototype.filters = function () {
var app = this.app;
app.post(this.pluginUrl, this.encryptCredentials.bind(this),
passport.authenticate('local', { failureRedirect:'/check' }), function (req, res) {
res.send({
status:0,
payload:req.user
});
});
passport.authenticate('local', { failureRedirect:'/check' }), this.onAuth.bind(this));

app.get(this.pluginUrl + '/check', this.ensureAuthenticated.bind(this));
app.get(this.pluginUrl + '/check', this.ensureAuthenticated.bind(this), this.onAuth.bind(this));

app.get(this.pluginUrl + '/logout', function (req, res) {
req.logOut();
Expand Down

0 comments on commit 90d3d84

Please sign in to comment.