bnoguchi/mongoose-auth

Don't create a session after registering

Opened this issue · 2 comments

Hi,

I would like to override what happen after a user has registered. I don't want people to be logged in automatically! If I understand well, I can override registerUser but it won't prevent the user to be logged in. addToSession() is called in any case :(

How can I do that?

Thanks

Hi, i am also very interested if someone could point to the right way of doing this.

I guess you can also override addToSession() method. I don't know which auth you are using, but here is how you can do it for facebook auth.

UserSchema.plugin(mongooseAuth, {
    everymodule: {
      // everyauth configs
    }
  , facebook: {
      everyauth: {
          // facebook oauth configs
        , findOrCreateUser: function (sess, accessTok, accessTokExtra, fbUser) {
            // find or create
            return promise;
          }
        , addToSession: function (session, auth) {
            // do anything with the sessions
          }
      }
    }
});