Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post('/account/login', function(req, res, next) {
- var token
- const email = req.body.data.email
- const pass = req.body.data.pass
- const fingerprint = req.body.data.fingerprint
- var data = {success:false, token:null}
- AccountModel.login(email, pass, (success, userID) => {
- console.log("success", success, typeof success)
- if(success){
- crypto.randomBytes(48, function(err, buffer) {
- data.token = buffer.toString('hex');
- data.userID = userID;
- AccountModel.saveToken(userID, data.token, fingerprint)
- data.successfully = true
- res.send( data )
- });
- }else{
- data.token = null
- res.send( data )
- }
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement