<commit_before>/* From <NAME> @ LabKey, recommended way to login via api June 2017 */

function chkRemember(){
    // examine cookies to determine if user wants the email pre-populated on form
    var h = document.getElementById('email');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.value = decodeURIComponent(LABKEY.Utils.getCookie("email"));
    };

    h = document.getElementById('remember');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.checked = true;
    } else {
        h.checked = false;
    };
}

function newLogin(){
    if(document.getElementById('remember').checked == true){
        LABKEY.Utils.setCookie('email', encodeURIComponent(document.getElementById('email').value), true, 360);
    } else {
        LABKEY.Utils.deleteCookie('email', true);
    }

    LABKEY.Ajax.request({
        url: LABKEY.ActionURL.buildURL('login', 'loginApi.api', this.containerPath),
        method: 'POST',
        params: {
            remember: document.getElementById('remember').value,
            email: document.getElementById('email').value,
            password: document.getElementById('password').value,
            // returnUrl: LABKEY.ActionURL.getParameter("returnUrl"),
        },
        success: LABKEY.Utils.getCallbackWrapper(function (response) {
            // if(response && response.returnUrl){
            //     window.location = response.returnUrl;
            // }
            window.location = LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
        }, this),
        failure: LABKEY.Utils.getCallbackWrapper(function (response) {
            if(document.getElementById('errors') && response && response.exception) {
                // Want special point to password reset not given by LK response
                if(response.exception.includes('did not match')){
                    document.getElementById('errors').innerHTML = 'Invalid Username or Password.<br> You can reset your password via the question mark link above.';
                } else {
                    document.getElementById('errors').innerHTML = response.exception;
                }
            }
            // if(response && response.returnUrl){
            //     window.location = response.returnUrl;
            // }
            window.location = LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
        }, this)
    });
}<commit_msg>extraWebapp: fix front page failure window.loc<commit_after>/* From <NAME> @ LabKey, recommended way to login via api June 2017 */

function chkRemember(){
    // examine cookies to determine if user wants the email pre-populated on form
    var h = document.getElementById('email');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.value = decodeURIComponent(LABKEY.Utils.getCookie("email"));
    };

    h = document.getElementById('remember');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.checked = true;
    } else {
        h.checked = false;
    };
}

function newLogin(){
    if(document.getElementById('remember').checked == true){
        LABKEY.Utils.setCookie('email', encodeURIComponent(document.getElementById('email').value), true, 360);
    } else {
        LABKEY.Utils.deleteCookie('email', true);
    }

    LABKEY.Ajax.request({
        url: LABKEY.ActionURL.buildURL('login', 'loginApi.api', this.containerPath),
        method: 'POST',
        params: {
            remember: document.getElementById('remember').value,
            email: document.getElementById('email').value,
            password: document.getElementById('password').value,
            returnUrl: LABKEY.ActionURL.getParameter("returnUrl"),
        },
        success: LABKEY.Utils.getCallbackWrapper(function (response) {
            if(response && response.returnUrl){
                window.location = response.returnUrl;
            }
            window.location = LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
        }, this),
        failure: LABKEY.Utils.getCallbackWrapper(function (response) {
            if(document.getElementById('errors') && response && response.exception) {
                // Want special point to password reset not given by LK response
                if(response.exception.includes('did not match')){
                    document.getElementById('errors').innerHTML = 'Invalid Username or Password.<br> You can reset your password via the question mark link above.';
                } else {
                    document.getElementById('errors').innerHTML = response.exception;
                }
            }
            // if(response && response.returnUrl){
            //     window.location = response.returnUrl;
            // }
            // window.location = LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
        }, this)
    });
}
{'fraction_non_alphanumeric': 0.13255523134639433, 'fraction_numerical': 0.0029178824510212586, 'mean_word_length': 2.3987252124645893, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7355526', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1193, 'n_words': 267}