Skip to content

Commit

Permalink
Update for style and correct test names.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Aug 20, 2015
1 parent bdb24ec commit 055b565
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/http/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ req.logIn = function(user, options, done) {
var self = this;
this._passport.instance.serializeUser(user, this, function(err, obj) {
if (err) { self[property] = null; return done(err); }
if(!self._passport.session) {
if (!self._passport.session) {
self._passport.session = {};
}
self._passport.session.user = obj;
if(!self.session) {
if (!self.session) {
self.session = {};
}
self.session[self._passport.instance._key] = self._passport.session;
self.session[self._passport.instance._key] = self._passport.session;
done();
});
} else {
Expand Down
5 changes: 3 additions & 2 deletions lib/strategies/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ SessionStrategy.prototype.authenticate = function(req, options) {

var self = this,
su;
if(req._passport.session)
su = req._passport.session.user;
if (req._passport.session) {
su = req._passport.session.user;
}

if (su || su === 0) {
// NOTE: Stream pausing is desirable in the case where later middleware is
Expand Down
6 changes: 3 additions & 3 deletions test/authenticator.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Authenticator', function() {
expect(request._passport.instance).to.equal(passport);
});

it('should expose session storage on internal request property', function() {
it('should not expose session storage on internal request property', function() {
expect(request._passport.session).to.be.undefined;
});
});
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Authenticator', function() {
expect(passport._userProperty).to.equal('currentUser');
});

it('should initialize namespace within session', function() {
it('should not initialize namespace within session', function() {
expect(request.session.passport).to.be.undefined;
});

Expand All @@ -89,7 +89,7 @@ describe('Authenticator', function() {
expect(request._passport.instance).to.equal(passport);
});

it('should expose session storage on internal request property', function() {
it('should not expose session storage on internal request property', function() {
expect(request._passport.session).to.be.undefined;
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/middleware/initialize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('middleware/initialize', function() {
expect(request._passport.instance).to.equal(passport);
});

it('should expose empty object as session storage on internal request property', function() {
it('should not expose empty object as session storage on internal request property', function() {
expect(request._passport.session).to.be.undefined;
});
});
Expand All @@ -65,7 +65,7 @@ describe('middleware/initialize', function() {
expect(error).to.be.undefined;
});

it('should initialize namespace within session', function() {
it('should not initialize namespace within session', function() {
expect(request.session.passport).to.be.undefined;
});

Expand All @@ -75,7 +75,7 @@ describe('middleware/initialize', function() {
expect(request._passport.instance).to.equal(passport);
});

it('should expose session storage on internal request property', function() {
it('should not expose session storage on internal request property', function() {
expect(request._passport.session).to.be.undefined;
});
});
Expand Down

0 comments on commit 055b565

Please sign in to comment.