Concorda / concorda-dashboard

concorda dashboard
MIT License
5 stars 8 forks source link

/auth/logout does not clear the session #104

Closed girishla closed 8 years ago

girishla commented 8 years ago

/auth/logout does not clear the session. This is probably also causing #96

I think req.cookieAuth.clear() needs to be called in hapi-auth.js like so:

  // LOGOUT START
 ....
 .....
 ...
        req.seneca.act("role:'user',cmd:'logout'", {token: clienttoken}, function (err) {
          if (err) {
            req.seneca.log('error ', err)
          }
          req.cookieAuth.clear();

          delete req.seneca.user
          delete req.seneca.login
          return req.seneca.act('role: auth, do: respond', {err: err, action: 'logout', req: req}, respond)
        })
      })
    })
  }

the express version seems to correctly call req.logout() to clear the passportJS session. Its just the hapi version that doesn't seem to.

Happy to do a PR if it helps.

mirceaalexandru commented 8 years ago

@girishla thank you, good point. Could you please create a PR?

Thank you

mcdonnelldean commented 8 years ago

@girishla Please do! Good catch

girishla commented 8 years ago

done!