Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post('/poster', async (req, res) => {
- var saltRounds = 8;
- var prepassword = req.body.password
- bcrypt.genSalt(saltRounds, function(err, salt) {
- bcrypt.hash(prepassword, salt, function(err, hash) {
- console.log(hash)
- db.any("insert into users (email, username, password)\
- values($1, $2, $3)", ['yeeeseer', req.body.username.toString(), hash])
- });
- });
- res.send('it worked, figure out error message later')
- });
- async function hashPass(hashPass){
- var saltRounds = 8;
- bcrypt.genSalt(saltRounds, function(err, salt) {
- bcrypt.hash(hashPass, salt, function(err, hash) {
- console.log(hash)
- //db.any("insert into users (email, username, password)\
- // values($1, $2, $3)", ['yeeeseer', req.body.username.toString(), hash])
- return hash
- });
- });
- }
- router.post('/poster', async (req, res) => {
- var username = req.body.username.toString()
- var hashedpass = await hashPass(req.body.password)
- db.any("insert into users (email, username, password)\
- values($1, $2, $3)", ['yeeeseer', username, hashedpass])
- res.send('it worked, figure out error message later')
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement