node.js - build 2 login system (user & admin) using passportjs -


i have built login system using passportjs , works charm. i'm struggling how differentiate login system admin. since use different database model schema in mongoosejs, i'm not sure how that. have searched on stackoverflow , found thread use multiple local strategies in passportjs, however, i'm still can't understand how apply current passport configuration. in code:

passport.serializeuser(function(user, done) {   if (isuser(user)) {     // serialize user   } else if (issponsor(user)) {     // serialize company   } }); 

what isuser , issponsor function in details? still can't , how apply code.

here's passport configuration right now. https://github.com/pepziman/gampangpoll-node-server/blob/master/config/passport.js

currently still using same local-login strategy both user , admin login, complete failure since user can access admin page using credentials. have made different login strategies called admin-login, using different mongoose model can't understand how change serializeuser , deserializeuser function meet need. solution appreciated. in advance


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -