<commit_before>var jwt    = require('jsonwebtoken');

var models = require('../models');
var users = models.users;

var isAuth = function(req, res, next) {

	var authHeader = req.headers.authorization;
	if (!authHeader) {
		return res.status(401).json({ success: false, message: "Authorization headers are missing." }).end();
  }
	authHeader = authHeader.split(" ");
	var token = authHeader[1];

	if (token) {
		jwt.verify(token, req.app.get('superSecret'), function(err, decoded) {
			if (err) {
				let errors = {};
				errors.token = 'invalid token'
				return res.status(400).json({ success: false, errors, message: 'Failed to authenticate token.' }).end();
			} else {
				// if everything is good, save to request for use in other routes
        req.decoded = decoded;
        next();
			}
		});
	}

  // User
  // .findOne({ where : { token : token}})
	// .then(function(user) {
	// 	if(!user)
	// 		return res.status(401).send({msg : "Invalid token."}).end();
	// 	else{
	// 		req.user = user;
	// 		next();
	// 	}
	// })
}

module.exports = isAuth;<commit_msg>Cleaned isAuth.js file<commit_after>var jwt    = require('jsonwebtoken');
// var models = require('../models');
// var users = models.users;
var isAuth = function(req, res, next) {

	var authHeader = req.headers.authorization;
	if (!authHeader) {
		return res.status(401).json({ success: false, message: "Authorization headers are missing." }).end();
  }
	authHeader = authHeader.split(" ");
	var token = authHeader[1];

	if (token) {
		jwt.verify(token, req.app.get('superSecret'), function(err, decoded) {
			if (err) {
				let errors = {};
				errors.token = '<PASSWORD>'
				return res.status(400).json({ success: false, errors, message: 'Failed to authenticate token.' }).end();
			} else {
				// if everything is good, save to request for use in other routes
        req.decoded = decoded;
        next();
			}
		});
	}
}

module.exports = isAuth;
{'fraction_non_alphanumeric': 0.17368694747789912, 'fraction_numerical': 0.008840353614144566, 'mean_word_length': 3.1555075593952484, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2985731', 'n_tokens_mistral': 693, 'n_tokens_neox': 627, 'n_words': 167}