<commit_before>/*
 * Plantalytics
 *     Copyright (c) 2016 <NAME>, <NAME>, <NAME>,
 *       <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
 *     This project is licensed under the MIT License.
 *     Please see the file LICENSE in this distribution for license terms.
 * Contact: <EMAIL>
 */

$(function() {
    /*
     * Listener for 'enter' keypress on #login* field.
     */
    $("#loginUsername, #loginPassword").keypress(function(evt) {
        if (evt.which == 13 && !evt.shiftKey) {
            $("#loginButton").trigger("click");
        }
    });

    $("#loginButton").click(function() {
        /* This function handles user login */
        $.ajax({
            "url": backendIpAddress + "login",
            "data": JSON.stringify({
                "username": $("#loginUsername").val(),
                "password": $("#<PASSWORD>").val()
            }),
            "type": "POST"
        }).done(function(json) {
            if (json.auth_token &&
                    json.vineyard_ids) {
                localStorage.accessToken = json.auth_token;
                localStorage.vineyardIds = JSON.stringify(json.vineyard_ids);
                window.location.href = "dashboard.html";
            } else {
                // Show error message.
                $("#loginError").text("Error logging in.");
            }
        }).fail(function() {
            // Show error message
            $("#loginError").text("Error logging in.");
        });
    });

    $('#forgotPassword').click(function() {<commit_msg>FE#53: Modify login to accept new authorized_vineyards array.<commit_after>/*
 * Plantalytics
 *     Copyright (c) 2016 <NAME>, <NAME>, <NAME>,
 *       <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
 *     This project is licensed under the MIT License.
 *     Please see the file LICENSE in this distribution for license terms.
 * Contact: <EMAIL>
 */

$(function() {
    /*
     * Listener for 'enter' keypress on #login* field.
     */
    $("#loginUsername, #loginPassword").keypress(function(evt) {
        if (evt.which == 13 && !evt.shiftKey) {
            $("#loginButton").trigger("click");
        }
    });

    $("#loginButton").click(function() {
        /* This function handles user login */
        $.ajax({
            "url": backendIpAddress + "login",
            "data": JSON.stringify({
                "username": $("#loginUsername").val(),
                "password": $("#loginPassword").val()
            }),
            "type": "POST"
        }).done(function(json) {
            if (json.auth_token &&
                    json.authorized_vineyards) {
                localStorage.accessToken = json.auth_token;
                localStorage.authorizedVineyards = JSON.stringify(json.authorized_vineyards);
                window.location.href = "dashboard.html";
            } else {
                // Show error message.
                $("#loginError").text("Error logging in.");
            }
        }).fail(function() {
            // Show error message
            $("#loginError").text("Error logging in.");
        });
    });

    $('#forgotPassword').click(function() {
{'fraction_non_alphanumeric': 0.16362471982068524, 'fraction_numerical': 0.004482869036183158, 'mean_word_length': 1.873965041398344, 'pattern_counts': {'":': 10, '<': 22, '<?xml version=': 0, '>': 22, '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': '1112367', 'n_tokens_mistral': 847, 'n_tokens_neox': 823, 'n_words': 191}