<%@language = "javascript" %>
<% /*
     $Revision$
     $Id$
*/ %>
<%
var JSON_Result = true;
var ANONYMOUS_Allowed = 1;
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/login.inc" -->
<!-- #include file="../Shared/json2.js" -->
<%

var nm = getFParam("vis_name");
var ps = getFParam("vis_pswd");
var otpcode = getFParam("otpcode", "");

var remember = getFParam("remember", "off")=="on";

var ismobile = getFParam("mobile");

tryLogin(nm, ps, ismobile, otpcode); // nm = username, ps = wachtwoord

result = { success: user_key > 0 };

if (user_key > 0)
{
    if (S("login_remember_days") > 0 && remember && user_key > 0)
        makeSessionCookie("Remember Login");
    result.success = true;
}
else
{
    if (otp_user_key > 0)
    {
        var otp_user = new Perslid(otp_user_key);
        var issuer = L("lcl_otp_issuer").format(HTTP.urlzelf());
        var friendly = L("lcl_otp_friendly").format(customerId, otp_user.oslogin(), otp_user.naam());

        result.otp_prompt = L("lcl_otp_enter").format(friendly, issuer);
        result.success = true;
    }
    else
    {
        result.message = login_fail_reason;
    }
}
Response.Write(JSON.stringify(result));
Response.End;

%>