<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const config = require('../lib/configuration'),
certifier = require('browserid-certifier')
  .client(config.get('certifier_host'), config.get('certifier_port'));

module.exports = function(app) {
  app.get('/.well-known/browserid', function(req, res) {
    res.setHeader('Content-Type', 'application/json');
    res.render('browserid.html');
  });

  app.get('/provision', function(req, res) {
    var provisioned = req.session.emails || [];
    res.render('provision.html', {
      browserid_server: config.get('browserid_server'),
      provisioned: JSON.stringify(provisioned)
    });
  });

  app.post('/provision', function(req, res) {
    var email = req.body.email,
        publicKey = req.body.publicKey,
        duration = req.body.duration;
    certifier(publicKey, email, duration, function(err, certificate) {
      if (err) {
        res.send(JSON.stringify({error: "Internal server error certifying"}), 500);
      } else {
        res.json({
          certificate: certificate
        });
      }
    });
  });

  app.get('/authentication', function(req, res) {
    res.render('authentication.html', {
      browserid_server: config.get('browserid_server'),
      currentEmail: 'null'
    });
  });

  app.post('/authentication', function(req, res) {
    res.setHeader('Content-Type', 'application/json');
    if ('<PASSWORD>' === req.body.password &&
        '<EMAIL>' === req.body.email) {
      if (! req.session.emails) {
        req.session.emails = [];
      }
      req.session.emails.push(req.body.email);
      res.send(JSON.stringify({status: "OK"}));
    } else {
      res.send(JSON.stringify({error: "Wrong username or password"}), 403);
    }
  });
};<commit_msg>8 char password<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const config = require('../lib/configuration'),
certifier = require('browserid-certifier')
  .client(config.get('certifier_host'), config.get('certifier_port'));

module.exports = function(app) {
  app.get('/.well-known/browserid', function(req, res) {
    res.setHeader('Content-Type', 'application/json');
    res.render('browserid.html');
  });

  app.get('/provision', function(req, res) {
    var provisioned = req.session.emails || [];
    res.render('provision.html', {
      browserid_server: config.get('browserid_server'),
      provisioned: JSON.stringify(provisioned)
    });
  });

  app.post('/provision', function(req, res) {
    var email = req.body.email,
        publicKey = req.body.publicKey,
        duration = req.body.duration;
    certifier(publicKey, email, duration, function(err, certificate) {
      if (err) {
        res.send(JSON.stringify({error: "Internal server error certifying"}), 500);
        console.log(err);
      } else {
        res.json({
          certificate: certificate
        });
      }
    });
  });

  app.get('/authentication', function(req, res) {
    res.render('authentication.html', {
      browserid_server: config.get('browserid_server'),
      currentEmail: 'null'
    });
  });

  app.post('/authentication', function(req, res) {
    res.setHeader('Content-Type', 'application/json');
    if ('<PASSWORD>' === req.body.password &&
        '<EMAIL>' === req.body.email) {
      if (! req.session.emails) {
        req.session.emails = [];
      }
      req.session.emails.push(req.body.email);
      res.send(JSON.stringify({status: "OK"}));
    } else {
      res.send(JSON.stringify({error: "Wrong username or password"}), 403);
    }
  });
};
{'fraction_non_alphanumeric': 0.17125064867669954, 'fraction_numerical': 0.005448884276076803, 'mean_word_length': 3.0707497360084477, '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': '5279544', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1190, 'n_words': 241}