<commit_before>// The main search module that allows users to view the Preference Terms Dictionary

(function ($) {
    "use strict";
    var login       = fluid.registerNamespace("ctr.components.login");
    var templates   = fluid.registerNamespace("ctr.components.templates");

    // Try to log in and display the results
    login.submit = function(that, event) {
        // Clear out any previous feedback before submitting
        $(that.container).find(".alert-box").remove();

        if (event) { event.preventDefault(); }
        var name = that.locate("name").val();
        var password = that.locate("password").val();
        var settings = {
            type:    "POST",
            url:     that.options.apiUrl + "/signin",
            success: that.displayReceipt,
            error:   that.displayError,
            data: { name: name, "password": password }
        };

        $.ajax(settings);
    };

    login.displayError = function(that, jqXHR, textStatus, errorThrown) {
        templates.prependTo(that.locate("form"),"error",{message: errorThrown});
    };

    login.displayReceipt = function(that, responseData, textStatus, jqXHR) {
        var jsonData = JSON.parse(responseData);
        if (jsonData && jsonData.ok) {
            that.applier.change("user",jsonData.user);

            templates.replaceWith(that.locate("viewport"),"login-form", that.model);
            that.controls.refresh(that);
        }<commit_msg>Tidied up indentation.<commit_after>// The main search module that allows users to view the Preference Terms Dictionary

(function ($) {
    "use strict";
    var login       = fluid.registerNamespace("ctr.components.login");
    var templates   = fluid.registerNamespace("ctr.components.templates");

    // Try to log in and display the results
    login.submit = function(that, event) {
        // Clear out any previous feedback before submitting
        $(that.container).find(".alert-box").remove();

        if (event) { event.preventDefault(); }
        var name     = that.locate("name").val();
        var password = that.locate("password").val();
        var settings = {
            type:    "POST",
            url:     that.options.apiUrl + "/signin",
            success: that.displayReceipt,
            error:   that.displayError,
            data: { name: name, "password": password }
        };

        $.ajax(settings);
    };

    login.displayError = function(that, jqXHR, textStatus, errorThrown) {
        templates.prependTo(that.locate("form"),"error",{message: errorThrown});
    };

    login.displayReceipt = function(that, responseData, textStatus, jqXHR) {
        var jsonData = JSON.parse(responseData);
        if (jsonData && jsonData.ok) {
            that.applier.change("user",jsonData.user);

            templates.replaceWith(that.locate("viewport"),"login-form", that.model);
            that.controls.refresh(that);
        }
{'fraction_non_alphanumeric': 0.13445090660280534, 'fraction_numerical': 0.0, 'mean_word_length': 2.5059952038369304, 'pattern_counts': {'":': 2, '<': 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': '2999815', 'n_tokens_mistral': 807, 'n_tokens_neox': 793, 'n_words': 182}