<commit_before>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    User = mongoose.model('User'),
    async = require('async'),
    config = require('meanio').loadConfig(),
    crypto = require('crypto'),
    nodemailer = require('nodemailer'),
    templates = require('../template');

exports.gameDataGet = function(req, res) {
    if (req.isAuthenticated()) {
		User.findOne({
			username: req.user.username
		})
		.exec(function(err, user) {
			if (!user) return res.send(new Error('Failed to load User '));
			if (user.creatures.length === 0) {
				user.creatures.push(
					{
						creature_id: 'basic',
						name: 'Creature',
						health: 50,
						attack: 10,
						defense: 5,
						creatyre_type: 'fire'
					}
				);
				user.save();
			}
			var data = {
				creatures: user.creatures,
				food: user.food
			};
			res.send(data);
		});
	}
};

exports.gameDataUpdate = function(req, res) {
    if (req.isAuthenticated()) {
		User.findOne({
			username: req.user.username
		})
		.exec(function(err, user) {
			if (!user) return res.send(new Error('Failed to load User '));
			if (req.body.creatures) user.creatures = req.body.creatures;
			if (req.body.food != undefined) user.food = req.body.food;
			user.save();
			res.send(user);
		});
	}
};

/**
 * Auth callback
 */
exports.authCallback = function(req, res) {
    res.redirect('/');
};

/**
 * Show login form
 */
exports.signin = function(req, res) {
    if (req.isAuthenticated()) {
        return res.redirect('/creature');
    }
    res.redirect('#!/login');
};

/**
 * Logout
 */
exports.signout = function(req, res) {
    req.logout();
    res.redirect('/');
};
<commit_msg>Styling and fixes 2<commit_after>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    User = mongoose.model('User'),
    async = require('async'),
    config = require('meanio').loadConfig(),
    crypto = require('crypto'),
    nodemailer = require('nodemailer'),
    templates = require('../template');

exports.gameDataGet = function(req, res) {
    if (req.isAuthenticated()) {
		User.findOne({
			username: req.user.username
		})
		.exec(function(err, user) {
			if (!user) return res.send(new Error('Failed to load User '));
			if (user.creatures.length === 0) {
				user.creatures.push(
					{
						creature_id: 'basic',
						name: 'Creature',
						health: 50,
						attack: 10,
						defense: 5,
						creatyre_type: 'fire'
					}
				);
				user.save();
			}
			var data = {
				creatures: user.creatures,
				food: user.food
			};
			res.send(data);
		});
	}
};

exports.gameDataUpdate = function(req, res) {
    if (req.isAuthenticated()) {
		User.findOne({
			username: req.user.username
		})
		.exec(function(err, user) {
			if (!user) return res.send(new Error('Failed to load User '));
			if (req.body.creatures) user.creatures = req.body.creatures;
			if (req.body.food !== undefined) user.food = req.body.food;
			user.save();
			res.send(user);
		});
	}
};

/**
 * Auth callback
 */
exports.authCallback = function(req, res) {
    res.redirect('/');
};

/**
 * Show login form
 */
exports.signin = function(req, res) {
    if (req.isAuthenticated()) {
        return res.redirect('/creature');
    }
    res.redirect('#!/login');
};

/**
 * Logout
 */
exports.signout = function(req, res) {
    req.logout();
    res.redirect('/');
};

{'fraction_non_alphanumeric': 0.18362503708098488, 'fraction_numerical': 0.00385642242657965, 'mean_word_length': 2.85812356979405, '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': '2355424', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1156, 'n_words': 229}