Odyssey
admStaticForms.i
1 <?php
2 /**
3  * Replaces formSu.prg
4  */
5 
6 function getStaticForm($SYSENV, $dbh, $name, $self, $Cn, $Cu)
7 {
8  switch($name)
9  {
10  case "formSu":
11  $parameters= array();
12  dms_import_v2($parameters, "BOTTOM", array("masterPassword" => "string", "authretry" => "string", "authact" => "string", "ft" => "string", "authval" => "string"));
13  extract($parameters["BOTTOM"]);
14  $authretry= isset($authretry) ? $authretry : 3;
15  $authact == "check" ? printMasterAccessCheck($SYSENV, $dbh, $self, $ft, $authretry, $authact, $Cn, $Cu, $masterPassword) : printMasterAccess($SYSENV, $self, $authretry, $authact);
16  break;
17  case "permErr":
18  printSimpleMessage("You do not have access to the feature you selected.");
19  break;
20  case "homecuDown":
21  printSimpleMessage("Digital Banking is temporarily unavailable because we are working on the system.<br>We expect to be finished in about an hour.<br><br>Please try again later.");
22  break;
23  case "serverBusy":
24  printSimpleMessage("Because of heavy volume Digital Banking is temporarily unavailable. <br>Please allow some time before trying again.");
25  break;
26  case "webOnly":
27  printSimpleMessage("The feature you requested is available as part of HomeCU, our complete digital banking software just for credit unions. <br><br>
28  <a href='http://www.homecu.net' class='link2'>Check out our web site</a> for more information, or click a link on the left to continue.");
29  break;
30  case "batMsg":
31  printSimpleMessage("The feature you requested is not needed for the HomeCU live interface.");
32  break;
33  case "notFound":
34  printSimpleMessage("The page you have requested was not found. Please use one of the links on the left.");
35  break;
36  default: ?>
37  Should not get here!
38  <?php break;
39  }
40 }
41 
42 function printMasterAccess($SYSENV, $self, $authretry, $authact, $msg="")
43 {
44  $authretry--; ?>
45  <script type="text/javascript">
46  function init()
47  {
48  $.homecuValidator.setup({formValidate:'form', formStatusField: 'formValidateDiv'});
49  <?php printCaptureEnter(); ?>
50  $("#okayBtn").click(function() {
51  if ($.homecuValidator.validate())
52  $(this).closest("#form").submit();
53 
54  return false;
55  });
56 
57  <?php if ($msg != "") { ?>
58  $("#formValidateDiv").text("<?php echo $msg; ?>");
59  $("#formValidateDiv").show();
60  <?php } ?>
61  }
62  $(document).ready(function() {
63  init();
64  });
65  </script>
66  <div class="container-fluid"><div class="row-fluid">
67  <form id="form" method="post" action="<?php echo $self; ?>">
68  <input type='hidden' name='authretry' value='<?php echo $authretry; ?>'>
69  <input type='hidden' name='authact' value='check'>
70  <div id="formValidateDiv" class="homecu-formStatus k-block k-error-colored" style="display:none;"></div>
71  <div class="well well-sm ">
72  <div class="form-horizontal form-widgets">
73  <?php printHeader("Requested Feature requires Master Privileges.");
74  loginPrintInputLine("Master Password", "", "masterPassword", 255, true, true, "password", "Password is required.");
75  printButtons(array(array("primary" => true, "id" => "okayBtn", "text" => "Continue")));
76  ?>
77  </div>
78  </div>
79  </form>
80  </div></div>
81 <?php }
82 
83 function printMasterAccessCheck($SYSENV, $dbh, $self, $ft, $authretry, $authact, $Cn, $Cu, $masterPassword)
84 {
85  try
86  {
87  $sth = db_query("select trim(passwd) from cuadminusers where user_name='" . strtolower($Cu) . "'",$dbh);
88  if (!$sth)
89  throw new exception("Query failed!", 1);
90  if (db_num_rows($sth) == 0)
91  throw new exception("Query has zero records!", 2);
92  list($mastpwd) = db_fetch_array($sth,0);
93  if (!password_verify($masterPassword, $mastpwd))
94  throw new exception("Crypt failed!", 3);
95  $authval = md5($Cn . 'HomeCU4U' . $ft);
96  }
97  catch(exception $e)
98  {
99  $SYSENV["logger"]->error("Master Access check failed!");
100  printMasterAccess($SYSENV, $self, $authretry, $authact, "Invalid Password");
101  return;
102  } ?>
103  <script type="text/javascript">
104  $(document).ready(function() {
105  $("#form").submit();
106  });
107  </script>
108  <div class="container-fluid"><div class="row-fluid">
109  <form id="form" method="post" action="<?php echo $self; ?>" role="form" data-role="validator" novalidate="novalidate">
110  <input type='hidden' name='authval' value='<?php echo $authval; ?>'>
111  <div class="well well-sm ">
112  <div class="form-horizontal form-widgets">
113  <div class="form-group">
114  <div class="col-xs-12">Thank you!</div>
115  </div>
116  </div>
117  </div>
118  </form>
119  </div></div>
120 <?php }
121 
122 function printSimpleMessage($msg)
123 { ?>
124  <div class="container-fluid"><div class="row-fluid">
125  <form id="form">
126  <div class="well well-sm ">
127  <div class="form-horizontal form-widgets">
128  <div class="form-group">
129  <div class="col-xs-12"><?php echo $msg; ?></div>
130  </div>
131  </div>
132  </div>
133  </form>
134  </div></div>
135 <?php }