<commit_before>'use strict';
const passport = require('passport'),
    LocalUser = require('../models').LocalUser;

const localConfig = function(app){

    passport.use(LocalUser.createStrategy());

    app.post('/login', passport.authenticate('local', { failureRedirect: '/login', failureFlash: true }), function(req, res, next) {
        req.session.save(function (err) {
            if (err) {
                return next(err);
            }
            res.redirect('ce');
        });
    });

    app.post('/register', function(req, res, next) {
        LocalUser.register(new LocalUser({ username : req.body.username }), req.body.password, function(err, account) {
            if (err) {
                console.log(err);<commit_msg>toi: Configuration for authenticate local users.<commit_after>'use strict';
const passport = require('passport'),
    LocalUser = require('../models').LocalUser;

const localConfig = function(app){

    passport.use(LocalUser.createStrategy());

    app.post('/login', passport.authenticate('local', { failureRedirect: '/login', failureFlash: true }), function(req, res, next) {
        req.session.save(function (err) {
            if (err) {
                return next(err);
            }
            res.redirect('toi');
        });
    });

    app.post('/register', function(req, res, next) {
        LocalUser.register(new LocalUser({ username : req.body.username }), req.body.password, function(err, account) {
            if (err) {
                console.log(err);
{'fraction_non_alphanumeric': 0.15852047556142668, 'fraction_numerical': 0.0, 'mean_word_length': 2.633093525179856, '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': '4400520', 'n_tokens_mistral': 429, 'n_tokens_neox': 413, 'n_words': 86}