Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. /* testing post with postman */
  2. postman, body
  3.  
  4. {
  5. "username": "johnt",
  6. "password": "$2a$10$8hdE2cphOK/6626H5x.g2U.lam94L5Z2ZQCVprE."
  7. }
  8.  
  9. /*orientdb users table */
  10. "username": "johnt",
  11. "password": "$2a$10$8hdE2cphOK/6626H5x.g2U.lam94L5Z2ZQCVprE."
  12.  
  13. // auth.js
  14. exports.post = (req, res) => {
  15. var username = req.body.username;
  16. db.select('username, password')
  17. .from('Users')
  18. .where('username = ' + "'" + username + "'")
  19. .all()
  20. .then((data) => {
  21. console.log(data);
  22. console.log(JSON.stringify(res.body, null, 4));
  23.  
  24. if (data.password = req.body.password) {
  25. res.json({ success: true, message: 'Authentication Succesful.' });
  26. }
  27.  
  28. });
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement