Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. router.post('/poster', async (req, res) => {
  2.     var username = req.body.username.toString()
  3.     var hashedpass = await hashPass(req.body.password)
  4.     db.any("insert into users (email, username, password)\
  5.              values($1, $2, $3)", ['yeeeseer', username, hashedpass])
  6.     console.log(hashedpass)
  7.     res.send('it worked, figure out error message later')
  8.  
  9. });
  10.  
  11. function hashPass(hashPass){
  12.     var saltRounds = 8;
  13.     bcrypt.genSalt(saltRounds, async function(err, salt) {
  14.         const hashPass = await bcrypt.hash(hashPass, salt,
  15.            function(err, hash) {
  16.             console.log(hash)
  17.             //db.any("insert into users (email, username, password)\
  18.               //        values($1, $2, $3)", ['yeeeseer', req.body.username.toString(), hash])
  19.  
  20.         });
  21.  
  22.     });
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement