<commit_before>module.exports = {
  signin: function (email, pass, cb) {
    cb = arguments[arguments.length - 1];
    if (localStorage.token) {
      if (cb) cb(true);
      this.onChange(true);
      return;
    }
    pretendRequest(email, pass, function (res) {
      if (res.authenticated) {
        localStorage.token = res.token;
        localStorage.acl = res.acl;
        if (cb) cb(true);
        this.onChange(true);
      } else {
        if (cb) cb(false);
        this.onChange(false);
      }
    }.bind(this));
  },

  getToken: function () {
    return localStorage.token;
  },

  signout: function (cb) {
    delete localStorage.token;
    if (cb) cb();
    this.onChange(false);
  },

  signedIn: function () {
    return !!localStorage.token;
  },

  acl: function() {
    return localStorage.acl;
  },

  onChange: function () {}
};

function pretendRequest(email, pass, cb) {
  setTimeout(function () {
    if ((email === '<EMAIL>' || email === 'aw') && pass === 'pw') {
      cb({
        authenticated: true,
        acl: 'proctor',
        token: Math.random().toString(36).substring(7)
      });
    } else if (email === '<EMAIL>' && pass === 'pw') {
      cb({<commit_msg>Fixed email login shortcut<commit_after>module.exports = {
  signin: function (email, pass, cb) {
    cb = arguments[arguments.length - 1];
    if (localStorage.token) {
      if (cb) cb(true);
      this.onChange(true);
      return;
    }
    pretendRequest(email, pass, function (res) {
      if (res.authenticated) {
        localStorage.token = res.token;
        localStorage.acl = res.acl;
        if (cb) cb(true);
        this.onChange(true);
      } else {
        if (cb) cb(false);
        this.onChange(false);
      }
    }.bind(this));
  },

  getToken: function () {
    return localStorage.token;
  },

  signout: function (cb) {
    delete localStorage.token;
    if (cb) cb();
    this.onChange(false);
  },

  signedIn: function () {
    return !!localStorage.token;
  },

  acl: function() {
    return localStorage.acl;
  },

  onChange: function () {}
};

function pretendRequest(email, pass, cb) {
  setTimeout(function () {
    if ((email === '<EMAIL>' || email === '<EMAIL>') && pass === 'pw') {
      cb({
        authenticated: true,
        acl: 'proctor',
        token: Math.random().toString(36).substring(7)
      });
    } else if (email === '<EMAIL>' && pass === 'pw') {
      cb({
{'fraction_non_alphanumeric': 0.17149958574979288, 'fraction_numerical': 0.0033140016570008283, 'mean_word_length': 2.372905027932961, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '4791780', 'n_tokens_mistral': 801, 'n_tokens_neox': 781, 'n_words': 172}