Viewing File: /usr/local/cpanel/base/frontend/jupiter/mail/loginlist.html.tt

[%
    SET FORM_LIST = RAW_FORM('email');
    SET listsp = FORM_LIST.split('@');
    SET listname = listsp.0;
    SET listdomain = listsp.1;

    SET otp = execute('Email','generate_mailman_otp', {
        'list' => (listname _ "@" _ listdomain)
    });

    IF otp.status == 1;
        SET result = {'status'=>1,'statusmsg'=>'OK'};
    ELSE;
        SET result = {'status'=>0,'statusmsg'=>otp.errors().0};
    END;

    SET goto_uri = "/3rdparty/mailman/" _ ( RAW_FORM('action') == "admindb" ? "admindb" : "admin") _ "/" _ listname _ "_" _ listdomain _ "/";

    IF CPANEL.is_webmail();
        SET url = CPANEL.ENV.cp_security_token _ goto_uri;
    ELSE;
        USE WebmailRedirect;
        SET webmail_session = WebmailRedirect.create_webmail_session( CPANEL.user, RAW_FORM.return_url );
        SET session = webmail_session.session;
        SET url = webmail_session.url;
    END;

    SET adminpw = otp.data();

    SET CPANEL.CPVAR.dprefix = '../';
%]

[% js_code = PROCESS js_block %]
[% WRAPPER '_assets/master.html.tt'
    app_key = 'mailing_lists'
    page_js = js_code
-%]
<div class="body-content">
    <h2 id="hdrAutoLogin">
      [% locale.maketext('Auto Login') %]
    </h2>
    [% IF result.status %]
        <div class="center-block">
            <img id="imgLoadingProgress" src="../images/loader.gif" alt="Loading progress image" />
        </div>
        <div class="section">
            <form action="[% url FILTER html %]" method="POST" id="loginForm">
                <input id="hdnAdminPw" type="hidden" name="adminpw" value="[% adminpw FILTER html %]" />
                [% IF CPANEL.is_cpanel() -%]
                    <input type="hidden" name="session" value="[% session.html() %]" />
                    <input type="hidden" name="goto_uri" value="[% goto_uri.html() %]">
                [% END -%]

                <div class="form-group">
                    <input id="btnLogin" type="submit" class="btn btn-primary" value="[% locale.maketext("Log in") %]" />
                </div>
            </form>
        </div>
    [% ELSE #result.status %]
        <div id="loginListErrorMsg" class="alert alert-danger">
            <span id="loginListErrorImg" class="glyphicon glyphicon-remove-sign"></span>
            <div id="loginListErrorMsg" class="alert-message">
            [% result.statusmsg FILTER html %]
            </div>
        </div>
    [% END %]
</div>
[% END #wrapper %]

[% BLOCK js_block %]
<script type="text/javascript">
    var canTrackUserAnalytics = ([% can_track_user_analytics.json() %] === "1");

    var submitForm = function(addQs) {
        var passThroughForm = CPANEL.Y.one("#loginForm");
        if (passThroughForm !== null) {
            passThroughForm.children.goto_uri.value = passThroughForm.children.goto_uri.value + addQs;
            passThroughForm.submit();
        }
    }

    var go = function() {
        if (canTrackUserAnalytics) {
            /* For preserving distinct_id.
             * Mixpanel setup should finish within the first 25 - 50 ms, but we'll wait up to a quarter of
             * a second. We don't want to make the redirect itself completely conditional on Mixpanel setup
             * finishing because if for some reason that is taking longer than expected (a privacy extension,
             * maybe?) it'll be better to just give up and complete the redirect without the distinct_id
             * instead of introducing an excessive delay. */

            var INTERVAL_TIME = 25;
            var MAX_WAIT      = 250;
            var waited        = 0;

            var interval = setInterval( function() {
                if (window.mixpanel && window.mixpanel.get_distinct_id()) {
                    clearInterval(interval);
                    submitForm('?mpidentity=' + encodeURI(window.mixpanel.get_distinct_id()));
                }
                else if (waited >= MAX_WAIT) {
                    clearInterval(interval);
                    submitForm('');
                }
                waited += INTERVAL_TIME;
            }, INTERVAL_TIME);
        }
        else {
            submitForm('');
        }
    }

    YAHOO.util.Event.onDOMReady(go);
</script>
[% END %]
Back to Directory File Manager