Guest User

Untitled

a guest
Dec 13th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. registerUser(params, callback) {
  2. var sql = "INSERT INTO users_data (first_name, last_name, email, role, registration_date, active, password) VALUES ('"+params.fName+"', '"+params.lName+"', '"+params.email+"', '"+params.role+"', '"+params.date+"', '"+1+"', '"+params.hashedPass+"')";
  3. con.query(sql, function (err, result) {
  4. if (err) throw err;
  5. callback(result);
  6. });
  7. }
  8.  
  9. bcrypt.genSalt(saltRounds, function(err, salt){
  10. bcrypt.hash(query.password, salt, function(err, hashedPass){
  11. console.log(hashedPass); //I get the hash printed here with no problems
  12. write.registerUser({
  13. data,
  14. fName,
  15. lName,
  16. email,
  17. role,
  18. date,
  19. hashedPass
  20. }, function(results){
  21. console.log(results)
  22. return();
  23. });
  24. });
  25. });
Add Comment
Please, Sign In to add comment