Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  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. return await bcrypt.hash(hashPass, salt,
  15. function(err, hash) {
  16.  
  17. });
  18.  
  19. });
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement