<commit_before>log = new Logger('server');

schoolNames = function (csvLine) {
  var keys = Object.keys(csvLine);
  var index = keys.indexOf('Title');
  keys.splice(index, 1);
  index = keys.indexOf('Reference');
  keys.splice(index, 1);
  index = keys.indexOf('Editor');
  keys.splice(index, 1);
  index = keys.indexOf('Subject');
  keys.splice(index, 1);
  index = keys.indexOf('Year');
  keys.splice(index, 1);
  index = keys.indexOf('Group');
  keys.splice(index, 1);

  return keys;
};

Meteor.methods({
  sendEmail: function (to, subject, text) {
    check([to, subject, text], [String]);

    // Let other method calls from the same client start running,
    // without waiting for the email sending to complete.
    this.unblock();

    Email.send({
      to: to,
      from: Settings.findOne({key: 'from-email'}).value,
      replyTo: Settings.findOne({key: 'reply-to-email'}).value,
      subject: subject,
      text: text
    });
  },
  isAdmin: function(userId) {
    return Houston._user_is_admin(userId)?true:false;
  }
});

Meteor.startup(function() {
  if (Settings.find().count() === 0) {
    Settings.insert({
      key: 'allow-sign-in',
      value: 'true'
    });

    Settings.insert({
      key: 'from-email',
      value: '<EMAIL>'
    });

    Settings.insert({
      key: 'reply-to-email',
      value: '<EMAIL>'
    });
  }
});

Accounts.validateNewUser(function () {
  if (Settings.findOne({key: 'allow-sign-in'}).value === 'true') {
    return true;
  }
  throw new Meteor.Error(403, 'User sign in is not authorized.');
});
<commit_msg>Fixes #19 changes to sign-up<commit_after>log = new Logger('server');

schoolNames = function (csvLine) {
  var keys = Object.keys(csvLine);
  var index = keys.indexOf('Title');
  keys.splice(index, 1);
  index = keys.indexOf('Reference');
  keys.splice(index, 1);
  index = keys.indexOf('Editor');
  keys.splice(index, 1);
  index = keys.indexOf('Subject');
  keys.splice(index, 1);
  index = keys.indexOf('Year');
  keys.splice(index, 1);
  index = keys.indexOf('Group');
  keys.splice(index, 1);

  return keys;
};

Meteor.methods({
  sendEmail: function (to, subject, text) {
    check([to, subject, text], [String]);

    // Let other method calls from the same client start running,
    // without waiting for the email sending to complete.
    this.unblock();

    Email.send({
      to: to,
      from: Settings.findOne({key: 'from-email'}).value,
      replyTo: Settings.findOne({key: 'reply-to-email'}).value,
      subject: subject,
      text: text
    });
  },
  isAdmin: function(userId) {
    return Houston._user_is_admin(userId)?true:false;
  }
});

Meteor.startup(function() {
  if (Settings.find().count() === 0) {
    Settings.insert({
      key: 'allow-sign-up',
      value: 'true'
    });

    Settings.insert({
      key: 'from-email',
      value: '<EMAIL>'
    });

    Settings.insert({
      key: 'reply-to-email',
      value: '<EMAIL>'
    });
  }
});

Accounts.validateNewUser(function () {
  if (Settings.findOne({key: 'allow-sign-up'}).value === 'true') {
    return true;
  }
  throw new Meteor.Error(403, 'User sign up is not authorized.');
});

{'fraction_non_alphanumeric': 0.17869634340222576, 'fraction_numerical': 0.0069952305246422895, 'mean_word_length': 3.1724137931034484, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3584225', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1052, 'n_words': 238}