<commit_before>var express = require('express');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('../models/User');
var router = express.Router();

passport.use(new LocalStrategy(User.authenticate()));
passport.serializeUser(User.serializeUser());
passport.deserializeUser(User.deserializeUser());

/* GET users listing. */
router.get('/', function(req, res){
  res.render('index', {user: req.user});
  User.find(function(err, users) {
    if (err) return (next(err));
    res.json(users);
  });
})

router.get('/login', function(req, res){
  res.render('account', {user: req.user});
})

router.post('/login', passport.authenticate('local', {failureRedirect: '/'}),
  function(req, res) {
    res.redirect('/');
  });

router.post('/register', function(req, res){
  User.register(new User({
    username: req.body.username,
    email: req.body.email,
    password: req.body.password
  }),
  req.body.password,
  function(err, account){
    if(err) {<commit_msg>redirect login failure<commit_after>var express = require('express');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('../models/User');
var router = express.Router();

passport.use(new LocalStrategy(User.authenticate()));
passport.serializeUser(User.serializeUser());
passport.deserializeUser(User.deserializeUser());

/* GET users listing. */
router.get('/', function(req, res){
  res.render('index', {user: req.user});
  User.find(function(err, users) {
    if (err) return (next(err));
    res.json(users);
  });
})

router.get('/login', function(req, res){
  res.render('account', {user: req.user});
})

router.post('/login', passport.authenticate('local', {failureRedirect: '/users/login'}),
  function(req, res) {
    res.redirect('/');
  });

router.post('/register', function(req, res){
  User.register(new User({
    username: req.body.username,
    email: req.body.email,
    password: <PASSWORD>
  }),
  req.body.password,
  function(err, account){
    if(err) {
{'fraction_non_alphanumeric': 0.19747695293546821, 'fraction_numerical': 0.0, 'mean_word_length': 4.925287356321839, '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': '4113334', 'n_tokens_mistral': 653, 'n_tokens_neox': 648, 'n_words': 127}