<commit_before>var express = require('express');
var router = express.Router();
var User  = require('./../app/models/user');

/* GET users listing. */
//router.get('/', function(req, res, next) {
//  res.send('respond with a resource');
//});

router.post('/accountinfo', function(req, res, done) {
  var currentUser = req.body.username;
  new User({username: currentUser})
    .fetch()
    .then(function(user){
      console.log('user',user);
      res.json(user);
    });
});

router.post('/accountupdate', function(req, res, done) {
  console.log('updating account');
  var currentUser = req.body.username;
  var data = req.body;
  new User({username: currentUser})
    .fetch()
    .then(function(user) {
      console.log('data:',data);
      user.save(data) 
        .then(function() {
          res.end('updated');
        });
    });
});

// Deprecated?
router.post('/checkUser', function(req, res, done) {
  console.log(req.body,'req..body');
  var currentUser = req.body.username;
  // check DB to see if current user has stripe information
  new User({username: currentUser})
    .fetch()
    .then(function(user){
      // console.log('user',user);
      // 
      if (user.attributes.venmoAccessToken && user.attributes.venmoUserId) {
        res.json({hasVenmoInfo: true});

      } else {
        res.json({hasVenmoInfo: false});
      }

    });

});

module.exports = router;
<commit_msg>add a backdoor for venmo for the presentation<commit_after>var express = require('express');
var router = express.Router();
var User  = require('./../app/models/user');

/* GET users listing. */
//router.get('/', function(req, res, next) {
//  res.send('respond with a resource');
//});

router.post('/accountinfo', function(req, res, done) {
  var currentUser = req.body.username;
  new User({username: currentUser})
    .fetch()
    .then(function(user){
      console.log('user',user);
      res.json(user);
    });
});

router.post('/accountupdate', function(req, res, done) {
  console.log('updating account');
  var currentUser = req.body.username;
  var data = req.body;
  new User({username: currentUser})
    .fetch()
    .then(function(user) {
      console.log('data:',data);
      user.save(data) 
        .then(function() {
          res.end('updated');
        });
    });
});

// Deprecated?
router.post('/checkUser', function(req, res, done) {
  console.log(req.body,'req..body');
  var currentUser = req.body.username;
  // check DB to see if current user has stripe information
  new User({username: currentUser})
    .fetch()
    .then(function(user){
      // console.log('user',user);
      // 
      if (user.attributes.venmoAccessToken && user.attributes.venmoUserId) {
        res.json({hasVenmoInfo: true});

      } else {
        res.json({hasVenmoInfo: true});
      }

    });

});

module.exports = router;

{'fraction_non_alphanumeric': 0.1829053816391136, 'fraction_numerical': 0.0, 'mean_word_length': 2.9720670391061454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7009031', 'n_tokens_mistral': 906, 'n_tokens_neox': 893, 'n_words': 187}