SHARE
TWEET

Untitled

a guest Aug 31st, 2012 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. post login('/api/login') {
  2.         email = params.get('email')
  3.         password = params.get('password')
  4.         # Check if user is in database and password is correct
  5.         users = database.users.find('email':email)
  6.         if users.length == 0
  7.                 res.send('member doesnt exist')
  8.         else
  9.                 if BCrypt.compare(password,users[0].passwordHash)
  10.                         #user logged in!
  11.                         express.session({userid: users[0]._id})
  12.                         res.send('loggedIn')
  13.                 else
  14.                         res.send('invalid password')
  15.  
  16. }
  17.  
  18. post logout('/api/logout') {
  19.         express.session({userid:'null'})       
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top