<commit_before>var CONTEXT_URI = process.env.CONTEXT_URI;

exports.requiresSession = function (req, res, next) {
    if (req.session.encodedUsername) {
        res.cookie('_eun', req.session.encodedUsername);
        next();
    } else {
        req.session.redirectUrl = CONTEXT_URI + req.originalUrl;
        if (req.url.split('?')[1] !== undefined) {
            var intent = "session.redirect";
            var redirectUrl = CONTEXT_URI + req.url;
            res.redirect(CONTEXT_URI + "/signup" + "?intent=" + intent + "&redirectUrl=" + encodeURIComponent(redirectUrl));
        } else {
            res.redirect(CONTEXT_URI + "/signup");
        }
    }
};

exports.setSession = function (req, res, user) {
    req.session.username = user.username;
    req.session.encodedUsername = user.encodedUsername;
    req.session.githubUsername = user.githubUser.username;
    req.session.avatarUrl = user.githubUser._json.avatar_url;
    res.cookie('_eun', req.session.encodedUsername);
};


exports.resetSession = function (req) {
    req.session.encodedUsername = null;
    req.session.auth = null;
    req.session.intent = null;
    req.session.oneselfUsername = null;
    req.session.username = null;
    req.session.githubUsername = null;
    req.session.avatarUrl = null;
};
<commit_msg>Destroy session redis way too.<commit_after>var CONTEXT_URI = process.env.CONTEXT_URI;

exports.requiresSession = function (req, res, next) {
    if (req.session.encodedUsername) {
        res.cookie('_eun', req.session.encodedUsername);
        next();
    } else {
        req.session.redirectUrl = CONTEXT_URI + req.originalUrl;
        if (req.url.split('?')[1] !== undefined) {
            var intent = "session.redirect";
            var redirectUrl = CONTEXT_URI + req.url;
            res.redirect(CONTEXT_URI + "/signup" + "?intent=" + intent + "&redirectUrl=" + encodeURIComponent(redirectUrl));
        } else {
            res.redirect(CONTEXT_URI + "/signup");
        }
    }
};

exports.setSession = function (req, res, user) {
    req.session.username = user.username;
    req.session.encodedUsername = user.encodedUsername;
    req.session.githubUsername = user.githubUser.username;
    req.session.avatarUrl = user.githubUser._json.avatar_url;
    res.cookie('_eun', req.session.encodedUsername);
};


exports.resetSession = function (req) {
    req.session.destory;
    req.session.encodedUsername = null;
    req.session.auth = null;
    req.session.intent = null;
    req.session.oneselfUsername = null;
    req.session.username = null;
    req.session.githubUsername = null;
    req.session.avatarUrl = null;
};

{'fraction_non_alphanumeric': 0.13480578827113482, 'fraction_numerical': 0.0007616146230007616, 'mean_word_length': 2.9984779299847792, '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': '1737321', 'n_tokens_mistral': 801, 'n_tokens_neox': 806, 'n_words': 141}