Location: PHPKode > projects > phlyMail Lite > phlymail/frontend/templates/auth.login.tpl
<script type="text/javascript" src="{frontend_path}/js/md5.js?{current_build}"></script>
<script type="text/javascript">
/*<![CDATA[*/
pw = '';
function AJAX_process(next)
{
    $('#prgr').css('visibility', 'hidden');
    if (next['error']) {
        alert(next['error']);
        return;
    }
    if (next['otp']) {
        secure_transmission(next['otp']);
    }
}

function get_otp()
{
    pw = document.authform.pass.value;
    document.authform.pass.value = '';
    $('#prgr').css('visibility', 'visible');
    $.ajax({url:'{PHP_SELF}&give_otp=1', dataType: 'json', success: AJAX_process, error: function() {document.authform.submit();} });
    return false;
}

function secure_transmission(otp)
{
    var sec, inp, inp2;
    if (1 == 0<!-- START extauth_on -->+1<!-- END extauth_on -->) {
        // This switch is only active, when an external authentication method is
        // active. In this case we cannot use the MD5 hash.
        sec = pw;
    } else {
        // phlyMail stores user passwords in md5 encrypted form, so we will
        // have to calculate both: the md5 of the entered password and the md5
        // of the combined string as well
        sec = calcMD5(calcMD5(pw) + otp);
    }

    // Cleaning the sensitive data, replacing it with the secured string
    inp = document.createElement('input');
    inp.type = 'hidden';
    inp.name = 'secure';
    inp.value = encodeURIComponent(sec);
    document.authform.appendChild(inp);

    inp2 = document.createElement('input');
    inp2.type = 'hidden';
    inp2.name = 'orig_url';
    inp2.value = encodeURIComponent(self.location.href);
    document.authform.appendChild(inp2);

    document.authform.submit();
}


$(document).ready( function () {
    $('#user').focus();
});
/*]]>*/
</script>
<form action="{PHP_SELF}" name="authform" method="post" onsubmit="return get_otp();">
    <table border="0" cellpadding="2" cellspacing="0" style="margin:auto;">
        <tr>
            <td>&nbsp;</td>
            <td colspan="2" class="l"><strong>{msg_authenticate}</strong><br />
            <!-- START error -->{error}<br><!-- END error -->
            </td>
        </tr>
        <tr>
            <td class="r"><strong>{msg_popuser}:</strong></td>
            <td class="l" colspan="2"><input id="user" type="text" name="user" value="{user}" size="20" /></td>
        </tr>
        <tr>
            <td class="r"><strong>{msg_poppass}:</strong></td>
            <td class="l" colspan="2"><input id="pw" type="password" name="pass" size="20" /></td>
        </tr>
        <tr>
            <td class="t l">
                <div id="prgr" class="prgr_outer" style="visibility:hidden">
                    <div class="prgr_inner_busy"></div>
                </div>
            </td>
            <td class="t l">
                <input type="submit" value="{msg_login}" style="margin-right: 8px;" />
            </td>
            <td class="l">
                <a href="{PHP_SELF}&amp;special=lost_pw">{msg_lost_pw}</a><!-- START register --><br />
                <a href="{PHP_SELF}&amp;special=register_me">{msg_reg_now}</a><!-- END register -->
            </td>
        </tr>
    </table>
</form>
Return current item: phlyMail Lite