<commit_before>hqDefine('registration/js/login', [
    'jquery',
    'blazy/blazy',
    'analytix/js/kissmetrix',
    'hqwebapp/js/captcha', // shows captcha
], function (
    $,
    blazy,
    kissmetrics
) {
    $(function () {
        // Blazy for loading images asynchronously
        // Usage: specify the b-lazy class on an element and adding the path
        // to the image in data-src="{% static 'path/to/image.jpg' %}"
        new blazy({
            container: 'body',
        });

        // populate username field if set in the query string
        const urlParams = new URLSearchParams(window.location.search);
        const username = urlParams.get('username');
        if (username) {
            var usernameElt = document.getElementById('id_auth-username');
            if (usernameElt) {
                usernameElt.value = username;
            }
        }

        kissmetrics.whenReadyAlways(function () {

            $('#cta-form-get-demo-button-body').click(function () {
                kissmetrics.track.event("Demo Workflow - Body Button Clicked");
            });

            $('#cta-form-get-demo-button-header').click(function () {
                kissmetrics.track.event("Demo Workflow - Header Button Clicked");
            });
        });<commit_msg>initialize the login controller only when enforcing SSO is enabled<commit_after>hqDefine('registration/js/login', [
    'jquery',
    'blazy/blazy',
    'analytix/js/kissmetrix',
    'registration/js/user_login_form',
    'hqwebapp/js/initial_page_data',
    'hqwebapp/js/captcha', // shows captcha
], function (
    $,
    blazy,
    kissmetrics,
    userLoginForm,
    initialPageData
) {
    $(function () {
        // Blazy for loading images asynchronously
        // Usage: specify the b-lazy class on an element and adding the path
        // to the image in data-src="{% static 'path/to/image.jpg' %}"
        new blazy({
            container: 'body',
        });

        // populate username field if set in the query string
        const urlParams = new URLSearchParams(window.location.search);
        const username = urlParams.get('username');
        if (username) {
            var usernameElt = document.getElementById('id_auth-username');
            if (usernameElt) {
                usernameElt.value = username;
            }
        }

        if (initialPageData.get('enforce_sso_login')) {
            let $passwordField = $('#id_auth-password');
            let loginController = userLoginForm.loginController({
                initialUsername: $('#id_auth-username').val(),
                passwordField: $passwordField,
                passwordFormGroup: $passwordField.closest('.form-group'),
            });
            $('#user-login-form').koApplyBindings(loginController);
            loginController.init();
        }

        kissmetrics.whenReadyAlways(function () {

            $('#cta-form-get-demo-button-body').click(function () {
                kissmetrics.track.event("Demo Workflow - Body Button Clicked");
            });

            $('#cta-form-get-demo-button-header').click(function () {
                kissmetrics.track.event("Demo Workflow - Header Button Clicked");
            });
        });
{'fraction_non_alphanumeric': 0.12828438948995363, 'fraction_numerical': 0.0, 'mean_word_length': 2.058601134215501, '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': '1368284', 'n_tokens_mistral': 903, 'n_tokens_neox': 875, 'n_words': 183}