Guest user appears in several groups although not added

Technical Support
  • I'm experiencing some strange behavior in my nodeBB forum that is closed for guests.

    In some groups there is the user guest (German: Gast) added as a member and cannot be kicked. Everytime I kick him he is still there, but the member count reduces by one and is not correct anymore. Is there any way to force a recalculation of the member counts?

    In some other groups the user guest does not appear as a member in the members list, but he appears on the groups overview page.

    I have to admit that the users of my forum were created automatically at login (if not existing already) via User.create() function. I can see in the Redis database that sometimes a user uid:null is created although my authorization plugin shouldn't create such user. The users will be automatically assigend to their respective groups by the plugin as well. This process might be the reason of the strange behavior, but I don't know what is wrong with my script. Have a look at the relevant snippet below:

      var User = module.parent.require('./user'),
        Groups = module.parent.require('./groups'),
        Auth = {};
      Auth.tryLogin = // ...
      Auth.login = function() {
        passport.use(new passportLocal({passReqToCallback: true}, Auth.continueLogin));
      Auth.continueLogin = function(req, username, password, next) {
        Auth.tryLogin(username.toLowerCase(), password, function(err, loginUser) {
          if (err) {
          } else {
            User.getUidByUsername(username.toLowerCase(), function(err2, uid) {
              if (err2) { next(err2); }
              else {
                if (!uid) {
                  User.create({ username: loginUser.username.toLowerCase(), email: }, function(err3, u) {
                    if (err3) { next(err3); }
                    uid = u;
                // ...
                loginUser.groups.forEach(function (group) {
                  Groups.join(, uid);
                next(null, { uid: uid }, '[[success:authentication-successful]]');
      module.exports = Auth;
    // ...
  • Hmm I thought this was fixed on v0.9.0 though.

  • I had this problem with v0.9.0, v0.9.1 and now on v0.9.2 as well. First I thought this could be a problem with my plugin, but I don't see any.

    By the way, I forgot to mention another error I'm experiencing that could be related. If I login a new user, that is then created with my authentication plugin, for the first time I receive the following error: Failed to serialize user into session. When I login a second time everything works as expected.

  • Any ideas?

Suggested Topics