<commit_before>var express = require('express'),
    app = express(),
    validate = require('../lib/validation.js')
    usersTable = require('../models/db.js').users,
    bcrypt = require('bcrypt-nodejs');

app.get('/signin', function(request, response) {

    response.render('./app/blocks/signin');

});

app.post('/signin', (request, response) => {
    var locals = {};
    reqBody = request.body;
    usersTable.find(reqBody['email-account'])
        .then(user=>{

            if (user.googlelogin) {
                
                locals.error = 'This user should use Google Sign-In';
                response.render('app/blocks/signin', locals);

            }

            else if (!validate.isValidEmail(reqBody['email-account']) || 

                !validate.isValidPassword(reqBody['password-account']) || 
                !bcrypt.compareSync(reqBody['password-account'], user.pw)) {

                locals.error = 'wrong email or password';
                response.render('app/blocks/signin', locals);

            }

            else {

                app.locals.me = user;
                response.render('app/blocks/eventchoice');

            }

        })
        .catch(error=>{

            locals.error = 'user does not exist';
            response.render('app/blocks/signin', locals);

        });
});


module.exports = app;<commit_msg>refactor: add spacing in code<commit_after>var express = require('express'),
    app = express(),
    validate = require('../lib/validation.js')
    usersTable = require('../models/db.js').users,
    bcrypt = require('bcrypt-nodejs');

app.get('/signin', function(request, response) {

    response.render('./app/blocks/signin');

});

app.post('/signin', (request, response) => {

    var locals = {};
    reqBody = request.body;

    usersTable.find(reqBody['email-account'])

        .then(user=>{

            if (user.googlelogin) {
                
                locals.error = 'This user should use Google Sign-In';
                response.render('app/blocks/signin', locals);

            }

            else if (!validate.isValidEmail(reqBody['email-account']) || 

                !validate.isValidPassword(reqBody['password-account']) || 
                !bcrypt.compareSync(reqBody['password-account'], user.pw)) {

                locals.error = 'wrong email or password';
                response.render('app/blocks/signin', locals);

            }

            else {

                app.locals.me = user;
                response.render('app/blocks/eventchoice');

            }

        })

        .catch(error=>{

            locals.error = 'user does not exist';
            response.render('app/blocks/signin', locals);

        });

});


module.exports = app;
{'fraction_non_alphanumeric': 0.15448927662668122, 'fraction_numerical': 0.0, 'mean_word_length': 1.9152542372881356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2528129', 'n_tokens_mistral': 785, 'n_tokens_neox': 738, 'n_words': 127}