<commit_before>const bcrypt = require('bcrypt');
const express = require('express');
const User = require('./models').User;
const database = require('./database');
const File = require('./models').File;

const router = new express.Router();

router.post('/signup', function(req, res) {
    const email = req.body.email;
    const password = req.body.password;
    const confirmPassword = req.body.confirmPassword;
    const name = req.body.name;

    User.findOne({ where: { email: email } }).then(function(user) {
        if (user !== null) {
            req.flash('signUpMessage', 'Email is already in use.');
            return res.redirect('/');
        }
        if (password !== confirmPassword) {
            req.flash('signUpMessage', 'Passwords do not match.');
            return res.redirect('/');
        }

        const salt = bcrypt.genSaltSync();
        const hashedPassword = bcrypt.hashSync(password, salt);

 
        
       User.create({
            email: email,
            password: <PASSWORD>,
            salt: salt,
            name: name
        }).then(function(response) {
            const data = response.get({plain:true});
            console.log("this is the data", data);

            File.findAll({ where: {user_id:data.id} }).then(function(results) {
                return res.render('profile.html', {
                    files: results,
                    user: data
                });
            });
        });

    });
});


router.post('/signin',  function(req, res) {
    const email = req.body.email;
    const password = <PASSWORD>;
    const remember = req.body.remember;
    const MAXAGE = 1000 * 60 * 60;

    User.findOne({ where: { email: email } }).then(function(user) {
        if (user === null) {
            req.flash('signInMessage', 'Incorrect email.');
            return res.redirect('/');
        }

        const match = bcrypt.compareSync(password, user.password);
        if (!match) {
            req.flash('signInMessage', 'Incorrect password.');
            return res.redirect('/');
        }

        req.flash('statusMessage', 'Signed in successfully!');
        req.session.currentUser = user.email;
        if (remember) {
            req.session.cookie.maxAge = MAXAGE;
        }
        res.redirect('/profile');
    });
});


router.get('/signout', function(req, res) {
    req.session.destroy();
    res.redirect('/');
});

module.exports = router;
<commit_msg>Blank spacing<commit_after>const bcrypt = require('bcrypt');
const express = require('express');
const User = require('./models').User;
const database = require('./database');
const File = require('./models').File;

const router = new express.Router();

router.post('/signup', function(req, res) {
    const email = req.body.email;
    const password = req.body.password;
    const confirmPassword = req.body.confirmPassword;
    const name = req.body.name;

    User.findOne({ where: { email: email } }).then(function(user) {
        if (user !== null) {
            req.flash('signUpMessage', 'Email is already in use.');
            return res.redirect('/');
        }
        if (password !== confirmPassword) {
            req.flash('signUpMessage', 'Passwords do not match.');
            return res.redirect('/');
        }

        const salt = bcrypt.genSaltSync();
        const hashedPassword = bcrypt.hashSync(password, salt);

 
        
       User.create({
            email: email,
            password: <PASSWORD>,
            salt: salt,
            name: name
        }).then(function(response) {
            const data = response.get({plain:true});
            console.log("this is the data", data);

            File.findAll({ where: {user_id:data.id} }).then(function(results) {
                return res.render('profile.html', {
                    files: results,
                    user: data
                });
            });
        });

    });
});


router.post('/signin',  function(req, res) {
    const email = req.body.email;
    const password = <PASSWORD>.body.password;
    const remember = req.body.remember;
    const MAXAGE = 1000 * 60 * 60;

    User.findOne({ where: { email: email } }).then(function(user) {
        if (user === null) {
            req.flash('signInMessage', 'Incorrect email.');
            return res.redirect('/');
        }

        const match = bcrypt.compareSync(password, user.password);
        
        if (!match) {
            req.flash('signInMessage', 'Incorrect password.');
            return res.redirect('/');
        }

        req.flash('statusMessage', 'Signed in successfully!');
        req.session.currentUser = user.email;
        if (remember) {
            req.session.cookie.maxAge = MAXAGE;
        }
        res.redirect('/profile');
    });
});


router.get('/signout', function(req, res) {
    req.session.destroy();
    res.redirect('/');
});

module.exports = router;

{'fraction_non_alphanumeric': 0.15412844036697249, 'fraction_numerical': 0.0032619775739041795, 'mean_word_length': 2.064334790755778, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5635039', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1332, 'n_words': 309}