<commit_before>function passChecks() {
  var error = false;
  var passField = $("#dialog form input[name='password']");
  var confirmField = $("#dialog form input.confirm_password");
  var password = passField.val();
  var passwordConfirm = confirmField.val();

  $("#dialog form input[name='password'], #dialog form input.confirm_password")
    .removeClass('oops')
    .removeClass('ok')
    .removeClass('mismatch')
    .removeClass('missing_confirm')
    .removeClass('missing')
    .removeClass('invalid');

  if (passwordConfirm.length && password !== passwordConfirm) {
    confirmField.addClass('oops').addClass('mismatch');
    error = true;
  }

  if (password.length && !validatePassword(password)) {
    passField.addClass('oops').addClass('invalid');
    error = true;
  }

  if (passwordConfirm.length && !validatePassword(passwordConfirm)) {
    confirmField.addClass('oops').addClass('invalid');
    error = true;
  }

  if (error) {
    offsetToError();
  }

  return !error;
}

setupFunctions["t1-create-signin"] = function() {
  $('#dialog form input.email').on('blur', function(e) {
    var email = this.value;
    $(this).removeClass('oops').removeClass('invalid').removeClass('missing');
    if (! validateEmail(email)) {

       $(this).addClass('oops').addClass('invalid');
       offsetToError();
       return;
      
    }
    $(this).addClass('ok');
  });

  $('#dialog form input.password').on('blur', function(e) {
    passChecks();
  });

  $('#dialog form input.confirm_password').on('blur', function(e) {
    passChecks();
  });

  $('#dialog form.login').on("submit", function(e) {
    leaveError();
    if(isBusy()) return false;
    e.preventDefault();
    var email = state.email = $("#dialog form.login input.email").val();
    var password = state.password = $("#dialog form.login input[name='password']").val();
    var error = false;

    if (! email.length) {
      $(this.email)
        .addClass('error')
        .addClass('oops')
        .addClass('missing');

      error = true;
    }

    if (! password.length) {
      $(this.password)
        .addClass('error')
        .addClass('oops')
        .addClass('missing');

      error = true;
    }

    if (error) {
      offsetToError();
      return false;
    }

    makeBusy();

    var client;
    Client.login(serverUrl, email, password)
      .done(function (x) {
        client = x;
        state.client = client

        console.log('got client', x);
        console.log('done logging in!');
        console.log('keys!!', client.sessionToken, client.keyFetchToken, email);

        new AssertionService(client).getAssertion(function(err, assertion) {
          var payload = {
            assertion: assertion,
            kB: client.kB,
            kA: client.kA,<commit_msg>Adding keys to login flow. Fixes #49.<commit_after>function passChecks() {
  var error = false;
  var passField = $("#dialog form input[name='password']");
  var confirmField = $("#dialog form input.confirm_password");
  var password = passField.val();
  var passwordConfirm = confirmField.val();

  $("#dialog form input[name='password'], #dialog form input.confirm_password")
    .removeClass('oops')
    .removeClass('ok')
    .removeClass('mismatch')
    .removeClass('missing_confirm')
    .removeClass('missing')
    .removeClass('invalid');

  if (passwordConfirm.length && password !== passwordConfirm) {
    confirmField.addClass('oops').addClass('mismatch');
    error = true;
  }

  if (password.length && !validatePassword(password)) {
    passField.addClass('oops').addClass('invalid');
    error = true;
  }

  if (passwordConfirm.length && !validatePassword(passwordConfirm)) {
    confirmField.addClass('oops').addClass('invalid');
    error = true;
  }

  if (error) {
    offsetToError();
  }

  return !error;
}

setupFunctions["t1-create-signin"] = function() {
  $('#dialog form input.email').on('blur', function(e) {
    var email = this.value;
    $(this).removeClass('oops').removeClass('invalid').removeClass('missing');
    if (! validateEmail(email)) {

       $(this).addClass('oops').addClass('invalid');
       offsetToError();
       return;
      
    }
    $(this).addClass('ok');
  });

  $('#dialog form input.password').on('blur', function(e) {
    passChecks();
  });

  $('#dialog form input.confirm_password').on('blur', function(e) {
    passChecks();
  });

  $('#dialog form.login').on("submit", function(e) {
    leaveError();
    if(isBusy()) return false;
    e.preventDefault();
    var email = state.email = $("#dialog form.login input.email").val();
    var password = state.password = $("#dialog form.login input[name='password']").val();
    var error = false;

    if (! email.length) {
      $(this.email)
        .addClass('error')
        .addClass('oops')
        .addClass('missing');

      error = true;
    }

    if (! password.length) {
      $(this.password)
        .addClass('error')
        .addClass('oops')
        .addClass('missing');

      error = true;
    }

    if (error) {
      offsetToError();
      return false;
    }

    makeBusy();

    var client;
    Client.login(serverUrl, email, password)
      .then(function (x) {
        client = x;
        console.log('got client', client);
        return client.keys()
      })
      .done(function (keys) {
        state.client = client

        console.log('done logging in!');
        console.log('keys!!', client.sessionToken, client.keyFetchToken, email);

        new AssertionService(client).getAssertion(function(err, assertion) {
          var payload = {
            assertion: assertion,
            kB: client.kB,
            kA: client.kA,
{'fraction_non_alphanumeric': 0.17187776011305422, 'fraction_numerical': 0.0007065889418830596, 'mean_word_length': 2.96221133659902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3363966', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1653, 'n_words': 329}