Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* testing post with postman */
- postman, body
- {
- "username": "johnt",
- "password": "$2a$10$8hdE2cphOK/6626H5x.g2U.lam94L5Z2ZQCVprE."
- }
- /*orientdb users table */
- "username": "johnt",
- "password": "$2a$10$8hdE2cphOK/6626H5x.g2U.lam94L5Z2ZQCVprE."
- // auth.js
- exports.post = (req, res) => {
- var username = req.body.username;
- db.select('username, password')
- .from('Users')
- .where('username = ' + "'" + username + "'")
- .all()
- .then((data) => {
- console.log(data);
- console.log(JSON.stringify(res.body, null, 4));
- if (data.password = req.body.password) {
- res.json({ success: true, message: 'Authentication Succesful.' });
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement