<commit_before>var mailer = require('../middlewares/mail').transport;
var logger = require('../lib/logger');

exports.newUserBadge = function (email, claimCode, req, callback) {
  var badgeName = req.badge.name;
  var url = req.siteUrl + "claim/"+claimCode;
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "You've earned the "+badgeName+" badge. Add it to your MyBadges page!",
    text: req.nunjucks.render('public/email/new-user-badge.txt', {url:url, badgeName: req.badge.name}),
    html: req.nunjucks.render('public/email/new-user-badge.html', {url:url, badgeName: req.badge.name})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};

exports.awardBadge = function (email, claimCode, req, callback) {
  var badgeName = req.badge.name;
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "You've earned the "+badgeName+" badge. Add it to your MyBadges page!",
    text: req.nunjucks.render('public/email/award-badge.txt', {badgeName: req.badge.name}),
    html: req.nunjucks.render('public/email/award-badge.html', {badgeName: req.badge.name})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};

exports.resetPw = function (email, uniqueId, req, callback) {
  var url = req.siteUrl + "reset-pw/"+uniqueId;
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "Reset your Maine State of Learning Password",
    text: req.nunjucks.render('public/email/reset-pw.txt', {url:url}),
    html: req.nunjucks.render('public/email/reset-pw.html', {url:url})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};<commit_msg>Adding name to badge award email for existing user<commit_after>var mailer = require('../middlewares/mail').transport;
var logger = require('../lib/logger');

exports.newUserBadge = function (email, claimCode, req, callback) {
  var badgeName = req.badge.name;
  var url = req.siteUrl + "claim/"+claimCode;
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "You've earned the "+badgeName+" badge. Add it to your My Badges page!",
    text: req.nunjucks.render('public/email/new-user-badge.txt', {url:url, badgeName: req.badge.name}),
    html: req.nunjucks.render('public/email/new-user-badge.html', {url:url, badgeName: req.badge.name})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};

exports.awardBadge = function (email, name, claimCode, req, callback) {
  var badgeName = req.badge.name;
  var url = req.siteUrl + "login";
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "You've earned the "+badgeName+" badge. Add it to your My Badges page!",
    text: req.nunjucks.render('public/email/award-badge.txt', {badgeName: req.badge.name, name: name, url: url}),
    html: req.nunjucks.render('public/email/award-badge.html', {badgeName: req.badge.name, name:name, url: url})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};

exports.resetPw = function (email, uniqueId, req, callback) {
  var url = req.siteUrl + "reset-pw/"+uniqueId;
  mailer.sendMail({
    from: 'Maine State of Learning <<EMAIL>>',
    to: email,
    subject: "Reset your Maine State of Learning Password",
    text: req.nunjucks.render('public/email/reset-pw.txt', {url:url}),
    html: req.nunjucks.render('public/email/reset-pw.html', {url:url})
  }, callback || function (err) {
    if (err) { console.log(err); }
  });
};
{'fraction_non_alphanumeric': 0.17492303386509936, 'fraction_numerical': 0.0, 'mean_word_length': 3.922865013774105, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6109044', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1257, 'n_words': 300}