<commit_before>// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by the MIT license, a copy of which can
// be found in the LICENSE file.

"use strict";

var LoginPage = function(application) {
  Page.call(this, application);
};

LoginPage.prototype = Object.create(Page.prototype);

// Attach the application login required for the login page, notably the ability
// to submit the full name to the user system.
LoginPage.prototype.OnRender = function(application, container, content) {
  var user = application.GetUser();
  if (user.isIdentified()) {
    console.error('The user has already identified as: ' + user.name);
    return;
  }

  var formElement = container.querySelector('#login-form'),
      nameElement = container.querySelector('#login-name'),
      errorElement = container.querySelector('#login-error');

  formElement.addEventListener('submit', function(event) {
    event.preventDefault();

    user.identify(nameElement.value).then(function() {
      application.Navigate('/');
    }, function(error) {
      errorElement.textContent = error.message;

      nameElement.parentElement.classList.add('error');
      var changeEvent = function() {
        nameElement.parentElement.classList.remove('error');
        nameElement.removeEventListener('keydown', changeEvent);
      };

      nameElement.addEventListener('keydown', changeEvent);
    });

    return false;

  }, false);
};<commit_msg>Use a hard refresh when logging in<commit_after>// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by the MIT license, a copy of which can
// be found in the LICENSE file.

"use strict";

var LoginPage = function(application) {
  Page.call(this, application);
};

LoginPage.prototype = Object.create(Page.prototype);

// Attach the application login required for the login page, notably the ability
// to submit the full name to the user system.
LoginPage.prototype.OnRender = function(application, container, content) {
  var user = application.GetUser();
  if (user.isIdentified()) {
    console.error('The user has already identified as: ' + user.name);
    return;
  }

  var formElement = container.querySelector('#login-form'),
      nameElement = container.querySelector('#login-name'),
      errorElement = container.querySelector('#login-error');

  formElement.addEventListener('submit', function(event) {
    event.preventDefault();

    user.identify(nameElement.value).then(function() {
      window.location.href = '/';
    }, function(error) {
      errorElement.textContent = error.message;

      nameElement.parentElement.classList.add('error');
      var changeEvent = function() {
        nameElement.parentElement.classList.remove('error');
        nameElement.removeEventListener('keydown', changeEvent);
      };

      nameElement.addEventListener('keydown', changeEvent);
    });

    return false;

  }, false);
};
{'fraction_non_alphanumeric': 0.12431693989071038, 'fraction_numerical': 0.00273224043715847, 'mean_word_length': 3.881666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7458119', 'n_tokens_mistral': 773, 'n_tokens_neox': 762, 'n_words': 212}