简体   繁体   中英

How to kick an user session? [node.js]

my system use passport.js for authentication. users are able to login and logout base on local strategies. I am working on a function that allow super user to kick an user from my system.

my current approach is to :

  1. set the user profile as disable
  2. delete the user session
  3. the user cannot login again because the user profile was disable(using local strategies)

How could I delete the user session in MongoStore?

"express": "~4.13.1",
"express-session": "~1.11.3",
"mongoose": "~4.0.7",
"passport": "~0.2.2",
"passport-local": "~1.0.0",

Just find all the user sessions in the sessions-collection in mongo and del them. Explore the collection using mongo cli. Then use mongo-native or mongoose module to del.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM