<commit_before>// Dependencies
var Request = require("request")
  , Config = require("../config")
  , Cheerio = require("cheerio")
  , QueryString = require("querystring")
  ;

// Auth
var Auth = module.exports = {};

// TODO JsDoc
Auth.getCookie = function (callback) {
    var $ = null;
    console.log("Getting the csrf-token.");
    Request.get(Config.login_page, function (err, res, body) {
        if (err) { return callback(err); }
        var token = Cheerio.load(body)("meta[name='csrf-token']").attr("content")
        console.log("csrf-token is: " + token);
        console.log("Logging in...");
        Request.post({
            url: "https://theartstack.com/sessions"
          , form: QueryString.stringify({
                "utf8": "✓"
              , "authenticity_token": "token"
              , "user_session[email]": Config.username
              , "user_session[password]": <PASSWORD>
              , "user_session[remember_me]": 0
              , "user_session[remember_me]": 1
              , "commit": "Log In"
            })
        }, function (err, res, body) {
            if (err) { return callback(err); }
            var cookies = res.headers["set-cookie"];
            callback(null, cookies);
        });
    });
};<commit_msg>Pass the email value instead of username<commit_after>// Dependencies
var Request = require("request")
  , Config = require("../config")
  , Cheerio = require("cheerio")
  , QueryString = require("querystring")
  ;

// Auth
var Auth = module.exports = {};

// TODO JsDoc
Auth.getCookie = function (callback) {
    var $ = null;
    console.log("Getting the csrf-token.");
    Request.get(Config.login_page, function (err, res, body) {
        if (err) { return callback(err); }
        var token = Cheerio.load(body)("meta[name='csrf-token']").attr("content")
        console.log("csrf-token is: " + token);
        console.log("Logging in...");
        Request.post({
            url: "https://theartstack.com/sessions"
          , form: QueryString.stringify({
                "utf8": "✓"
              , "authenticity_token": "token"
              , "user_session[email]": Config.email
              , "user_session[password]": Config.password
              , "user_session[remember_me]": 0
              , "user_session[remember_me]": 1
              , "commit": "Log In"
            })
        }, function (err, res, body) {
            if (err) { return callback(err); }
            var cookies = res.headers["set-cookie"];
            callback(null, cookies);
        });
    });
};
{'fraction_non_alphanumeric': 0.16280894468418988, 'fraction_numerical': 0.0023538642604943117, 'mean_word_length': 2.163771712158809, 'pattern_counts': {'":': 14, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '564015', 'n_tokens_mistral': 770, 'n_tokens_neox': 755, 'n_words': 156}