<commit_before>{% extends "/base.html" %}

{% import "/login/widget.html" as login_widget %}

{%block imports %}
<script src="/static/js/database.js"></script>
<script>
$(document).ready(function() {

  $("#gn-register-btn").click(function(event) {
    event.preventDefault();
    console.log('in event')
    var username = $("#gn-register-username").val();
    var password = $("#<PASSWORD>").val();
    Database.register(username, password).done(function(){
      Database.login(username, password).done(function() {
        window.location = "/clockin";
      })
    }).fail(function(){
      alert("failed");
    });
  });
  $("#gn-register-btn").attr("disabled", "disabled");
  $("#gn-register-username").on("input", function() {
    validateInfo();
  });
  $("#gn-register-password").on("input", function() {
    validateInfo();
  });
  function validateInfo() {
    var username = $("#gn-register-username").val();
    var password = $("#<PASSWORD>").val();
    if(username.length === 0 || password.length === 0) {
      $("#gn-register-btn").attr("disabled", "disabled");
    }
    else {
      $("#gn-register-btn").removeAttr("disabled");
    }

    Database.validUsername(username).done(function(){
      $("#gn-register-username").parent(".form-group").addClass("has-success");
      $("#gn-register-username").parent(".form-group").removeClass("has-error");
    }).fail(function(){
      $("#gn-register-username").parent(".form-group").addClass("has-error");
      $("#gn-register-username").parent(".form-group").removeClass("has-success");
    });
    // if(password.length >= 5) {
    //   $("#gn-register-password").parent(".form-group").addClass("has-success");
    //   $("#gn-register-password").parent(".form-group").removeClass("has-error");
    // }
    // else if( password.length == 0) {
    //   $("#gn-register-password").parent(".form-group").removeClass("has-success");
    //   $("#gn-register-password").parent(".form-group").removeClass("has-error");
    // }
    // else {
    //   $("#gn-register-password").parent(".form-group").removeClass("has-success");
    //   $("#gn-register-password").parent(".form-group").addClass("has-error");
    // }
  }
});
</script>

{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row gnomon-index-content">
        <div class="col-sm-8 col-sm-offset-2"><commit_msg>fix sign up<commit_after>{% extends "/base.html" %}

{% import "/login/widget.html" as login_widget %}

{%block imports %}
<script src="/static/js/database.js"></script>
<script>
$(document).ready(function() {

  $("#gn-register-btn").click(function(event) {
    event.preventDefault();
    console.log('in event')
    var username = $("#gn-register-username").val();
    var password = $("#<PASSWORD>").val();
    Database.register(username, password).done(function(){
      Database.login(username, password).done(function() {
        window.location = "/clockin";
      })
    }).fail(function(){
      alert("failed");
    });
  });
  $("#gn-register-btn").attr("disabled", "disabled");
  $("#gn-register-username").on("input", function() {
    validateInfo();
  });
  $("#gn-register-password").on("input", function() {
    validateInfo();
  });
  function validateInfo() {
    var username = $("#gn-register-username").val();
    var password = $("#<PASSWORD>").val();
    if(username.length === 0 || password.length === 0) {
      $("#gn-register-btn").attr("disabled", "disabled");
    }

    Database.validUsername(username).done(function(){

      $("#gn-register-btn").attr("disabled", "disabled");
      if(username.length === 0 || password.length === 0) {
        $("#gn-register-btn").attr("disabled", "disabled");
      }
      else {
        $("#gn-register-btn").removeAttr("disabled");
      }


      $("#gn-register-username").parent(".form-group").addClass("has-success");
      $("#gn-register-username").parent(".form-group").removeClass("has-error");
    }).fail(function(){
      $("#gn-register-username").parent(".form-group").addClass("has-error");
      $("#gn-register-username").parent(".form-group").removeClass("has-success");
    });
    // if(password.length >= 5) {
    //   $("#gn-register-password").parent(".form-group").addClass("has-success");
    //   $("#gn-register-password").parent(".form-group").removeClass("has-error");
    // }
    // else if( password.length == 0) {
    //   $("#gn-register-password").parent(".form-group").removeClass("has-success");
    //   $("#gn-register-password").parent(".form-group").removeClass("has-error");
    // }
    // else {
    //   $("#gn-register-password").parent(".form-group").removeClass("has-success");
    //   $("#gn-register-password").parent(".form-group").addClass("has-error");
    // }
  }
});
</script>

{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row gnomon-index-content">
        <div class="col-sm-8 col-sm-offset-2">
{'fraction_non_alphanumeric': 0.24949290060851928, 'fraction_numerical': 0.002839756592292089, 'mean_word_length': 3.446348061316501, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, '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': '3075913', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1481, 'n_words': 181}