daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Aug 31st, 2012 5 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. post signup('/api/signup/') {
  2.         password = getParam('password')
  3.         username = getParam('username')
  4.         email = getParam('email')
  5.         uuid = generateUUID()
  6.         object =
  7.                 password: password
  8.                 username: username
  9.                 email: email
  10.                 token: uuid
  11.         database.pendingUsers.insert(object)
  12.         mailer.sendEmail(email,'Please click on this link to register www.website.com/api/createUser/' + uuid)
  13. }
  14.  
  15. get createUser('/api/createUser/:token') {
  16.         token = getParam('token')
  17.         # lookup db for token
  18.         results = database.find('token':token)
  19.         if results.length == 0
  20.                 res.send('pending member doesn't exist!')
  21.         else
  22.                 pendingMember = results[0]
  23.                 passwordHash = BCrypt(password)
  24.                 object =
  25.                         username:pendingMember.username
  26.                         passwordhash:passwordHash
  27.                         email:email
  28.                 database.users.insert(object)
  29.                 res.send('user created, proceed to login)
  30. }
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