<%@language = "javascript" %>
<% /*
     $Revision$
     $Id$

     Stuur een tijdelijk wachtwoord via SMS
*/
ANONYMOUS_Allowed = 1;
%>
<!--#include file="../Shared/common.inc"-->
<%
    if (S("mobile_password") != 1
         && (S("mobile_password_pda") == 0 || !device.test(device.isMobile))
        )
    {
      shared.simpel_page(L("lcl_no_auth"));
    }

    var pLogin = getQParam("login");
%>
<html>
<head>
<%
  var code = shared.random(8, 'base32').toLowerCase(); // Effectief 40 bit/ 5 byte

  sql = "UPDATE prs_perslid "
      + "   SET prs_perslid_authenticatie = " + safe.quoted_sql(code)
      + "     , prs_perslid_authenticatie_exp = sysdate + (1/(24*60))*"+S("mobile_password_exp")
      + " WHERE (  UPPER(prs_perslid_email) = " + safe.quoted_sql_upper(pLogin)
      + "       OR UPPER(prs_perslid_oslogin) = " + safe.quoted_sql_upper(pLogin)
      + "       )";
  Oracle.Execute(sql);

  sql = "SELECT prs_perslid_authenticatie, prs_perslid_mobiel"
      + "  FROM prs_perslid"
      + " WHERE (  UPPER(prs_perslid_email) = " + safe.quoted_sql_upper(pLogin)
      + "       OR UPPER(prs_perslid_oslogin) = " + safe.quoted_sql_upper(pLogin)
      + "       )"
      + "   AND prs_perslid_mobiel IS NOT NULL";
  oRs = Oracle.Execute(sql);
  if (!oRs.Eof)
  {
    var password = oRs("prs_perslid_authenticatie").Value;
    var mobiel = oRs("prs_perslid_mobiel").Value;
    var puo_result = putorders.sendSMS(mobiel, L("lcl_vis_log_psw")+ " " + password);
    __Log ("SMS bericht verzonden naar: " + mobiel);
  }

%>
</head>
<body>
<p>Hier geen indicatie of de gebruikersnaam al dan niet bestaat.</p>
</body>
</html>
<% ASPPAGE_END(); %> 
