<commit_before>var LocalStrategy = require('passport-local').Strategy;
var FacebookStrategy = require('passport-facebook').Strategy;
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var User = require('../routes/models/user');
var configAuth =  require('./auth');
module.exports = function(passport) {
    //serializing the data
    passport.serializeUser(function (user, done) {
        done(null, user.id);
    });

    passport.deserializeUser(function (id, done) {
        User.findById(id, function (err, user) {
            done(err, user);
        });
    });
    //local signup
    passport.use('local-signup', new LocalStrategy({
        usernameField: 'username',
        passwordField: 'password',
        passReqToCallback: true
    },function(req, username, password, done) {
        process.nextTick(function () {
            User.findOne({'user_name': username}, function (err, user) {
                if (err)
                    return done(err);
                if (user) {
                    return done(null, false, req.flash('signupMessage', 'The username is already registered!!'));
                } else {
                    var newUser = new User();
                    newUser.email = req.body.email;<commit_msg>Update passport.js<commit_after>var LocalStrategy = require('passport-local').Strategy;
var FacebookStrategy = require('passport-facebook').Strategy;
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var User = require('../routes/models/User.js');
var configAuth =  require('./auth');
module.exports = function(passport) {
    //serializing the data
    passport.serializeUser(function (user, done) {
        done(null, user.id);
    });

    passport.deserializeUser(function (id, done) {
        User.findById(id, function (err, user) {
            done(err, user);
        });
    });
    //local signup
    passport.use('local-signup', new LocalStrategy({
        usernameField: 'username',
        passwordField: 'password',
        passReqToCallback: true
    },function(req, username, password, done) {
        process.nextTick(function () {
            User.findOne({'user_name': username}, function (err, user) {
                if (err)
                    return done(err);
                if (user) {
                    return done(null, false, req.flash('signupMessage', 'The username is already registered!!'));
                } else {
                    var newUser = new User();
                    newUser.email = req.body.email;
{'fraction_non_alphanumeric': 0.13438735177865613, 'fraction_numerical': 0.0007905138339920949, 'mean_word_length': 2.3927613941018766, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '187136', 'n_tokens_mistral': 687, 'n_tokens_neox': 672, 'n_words': 154}