Odyssey
userSupportStatus.prg
1 <?php
2 /**
3  * @package UserSupport (Subpackage status)
4  * @author SPB
5  *
6  * This script is run when the "status" card is clicked from the user hub.
7  */
8 
9 require_once("$admLibrary/addUser.i");
10 $string = array("filter" => FILTER_DEFAULT);
11 HCU_ImportVars($parameters, "a", array("operation" => $string, "payload" => $string, "ft" => $string, "userId" => $string));
12 extract($parameters["a"]);
13 
14 $operation = is_null($operation) ? "" : trim($operation);
15 
16 if ($operation != "") {
17  switch($operation) {
18  case "saveUser":
19  $returnArray = saveStatus($dbh, $Cu, $Cn);
20  break;
21  default: // Won't get here
22  $returnArray = array("error" => array("Operation not specified: '$operation'"), "record" => array());
23  }
24 
25  header('Content-type: application/json');
26  print HCU_JsonEncode($returnArray);
27 } else {
28  try {
29  $userId = HCU_PayloadDecode($Cu, $payload);
30  } catch(exception $e) { ?>
31  <div class='noUserFound'><div>No User Found</div></div>
32  <?php exit;
33  }
34  printPage("$menu_link?ft=$ft", $userId["user_id"], getUserData($dbh, $Cu, $userId["user_id"]));
35 }
36 
37 /**
38  * function getUserData($dbh, $cuCode, $userId)
39  *
40  * Gets data for the status tab in userMaint.
41  *
42  * @param integer $dbh The database connection
43  * @param string $cuCode The Credit Union
44  * @param integer $userId The userId of the ${cuCode}user record.
45  *
46  * @return array("code" => integer, "errors" => array(), "data" => array()); If there are errors, code is non-zero. If $includeSQL is true, then array("sqls" => array()) is also available.
47  */
48 function getUserData($dbh, $Cu, $userId) {
49 
50  try {
51  $usePhonesInsteadOfMFA = getUsePhonesInsteadOfMFA($dbh, $Cu);
52  $EMAIL_FLAG = GetMsgTxValue('MSGTX_FORCE_EM');
53 
54  // missing estmnt_flag, depositlimit, pktdate, user_alias, billpayid, cuadmin.cookie_ver
55  $sql = "
56  SELECT
57  u.user_id, u.user_name, u.name AS realname, u.lastlogin, t.last_txt, coalesce(ca.retrylimit,5) AS retry, coalesce(ca.gracelimit,5) AS grace, u.email,
58  'Y' AS estmnt_flag,
59  u.egenl_flag, u.failedremain, u.forcechange, u.forceremain, u.employee, msg_tx & $EMAIL_FLAG::int2 AS ask_email, u.userflags, u.failedlogin, ca.pwdconfig, u.ip,
60  u.confidence, uc.phones, u.mfaquest, ca.min_chlng_qst AS mfa_num_req
61  FROM ${Cu}user u
62  LEFT JOIN (
63  SELECT ucuc.user_id, max(st.yearmo) AS last_txt
64  FROM cusmstrack st
65  INNER JOIN ${Cu}useraccounts ucuc ON st.cu = '$Cu' AND ucuc.accountnumber = st.accountnumber
66  GROUP BY ucuc.user_id
67  ) t ON u.user_id = t.user_id
68  LEFT JOIN ${Cu}usercontact uc ON u.contact = uc.contact_id
69  LEFT JOIN cuadmin ca ON ca.cu = '$Cu'
70  WHERE u.user_id = $userId";
71 
72  $sth = db_query($sql,$dbh);
73  if (!$sth) {
74  throw new exception("User query failed.", 1);
75  }
76  $array = db_num_rows($sth) > 0 ? db_fetch_assoc($sth, 0) : array();
77  $records = array();
78  foreach($array as $key => $value) {
79  $array[$key] = trim($value);
80  }
81 
82  $array["booleanVerifyEmail"] = $array["ask_email"] != 0;
83  $array["booleanForceChange"] = $array["forcechange"] == "Y";
84  $array["booleanForceSecurity"] = ($array["userflags"] & 2) != 0;
85  $array["booleanEmployee"] = $array["employee"] == "Y";
86  $array["booleanLockAccount"] = $array["failedremain"] < 1 || (($array["booleanForceChange"] || $array["booleanForceSecurity"]) && $array["forceremain"] < 1);
87  $array["booleanOptin"] = $array["egenl_flag"] == "Y";
88  // #3044: billPay option is no longer available
89  // If necessary, we will need to use perms on profile
90  // --------------------
91  //$array["booleanBillPay"] = ($array["userflags"] & GetUserFlagsValue("MEM_ASKBPAY")) != 0;
92  $array["textLockout"] = $array["failedremain"] == -1 ? "Locked By CU" : $array["failedremain"];
93  $array["numRemaining"] = $array["booleanForceSecurity"] ? $array["forceremain"] : $array["grace"];
94 
95  $userflags = intval($array["userflags"]);
96  $array["failreason"] = $userflags & GetUserFlagsValue("MEM_LOGIN_FAILED_EMAIL") ? "Email" :
97  ($userflags & GetUserFlagsValue("MEM_LOGIN_FAILED_QST") ? "Challenge Response" :
98  ($userflags & GetUserFlagsValue("MEM_LOGIN_FAILED_PWD") ? "Password" : ($userflags & GetUserFlagsValue("MEM_LOGIN_FAILED_ALIAS") ? "Username" :
99  ($userflags & GetUserFlagsValue("MEM_LOGIN_FAILED_SAC") ? "Secure Access Code" : ""))));
100 
101  if ($usePhonesInsteadOfMFA) {
102  $mfaquest = HCU_JsonDecode($array["mfaquest"]);
103  $authexpires = HCU_array_key_exists("authexpires", $mfaquest) ? intval($mfaquest["authexpires"]) : 0;
104  $timeExpires = $authexpires == 0 ? null : dateTime::createFromFormat("U", $authexpires);
105  if (isset($timeExpires)) {
106  $sql = "select trim(tz) from cuadmin where cu='$Cu'";
107  $sth = db_query($sql, $dbh);
108  if (!$sth) {
109  throw new exception("timezone query failed.", 4);
110  }
111  if (!db_num_rows($sth)) {
112  throw new exception("no CU found.", 5);
113  }
114  list($tz) = db_fetch_array($sth, 0);
115 
116  $tz = ("$tz" == "" ? "Mountain" : $tz);
117  if (strpos("$tz","/") === false) $tz = "US/$tz";
118 
119  $timeExpires->setTimezone(new DateTimeZone($tz));
120  $timeExpires = $timeExpires->format("m/d/Y h:i:s A");
121 
122  $newMFA = array("date" => $timeExpires, "expired" => $authexpires <= gmdate("U"),
123  "code" => HCU_array_key_exists("authcode", $mfaquest) ? trim($mfaquest["authcode"]) : "",
124  "isset" => true);
125  } else {
126  $newMFA = array("date" => "", "expired" => false, "code" => "", "isset" => false);
127  }
128 
129  $array["mfaquest"] = $newMFA;
130  } else {
131  $challengeQuestions = getAdmChallengeQuestions($dbh, $Cu, $array["user_name"], "admin display", true);
132  $array["mfaquest"] = $challengeQuestions["data"];
133  }
134 
135  if ($array["ip"] == "") {
136  $array["cuIps"] = array();
137  } else {
138  $cuIps = explode(";", $array["ip"]);
139  foreach($cuIps as $ip) {
140  $validate = explode(".", $ip);
141  if (count($validate) != 4) {
142  throw new exception("IP addresses are not valid.", 6);
143  }
144  foreach($validate as $num) {
145  if (!is_numeric($num)) {
146  throw new exception("IP addresses are not valid.", 7);
147  }
148  if ($num < 0 || $num > 256) {
149  throw new exception("IP addresses are not valid.", 8);
150  }
151  }
152  }
153  $array["cuIps"] = $cuIps;
154  }
155  unset($array["ip"]);
156 
157  if ($usePhonesInsteadOfMFA) {
158  $phones = HCU_JsonDecode($array["phones"]);
159  $newPhones = array();
160  foreach($phones as $type => $value) {
161  if ($type == "mobile") {
162  $array["phones"] = $value;
163  }
164  }
165  }
166 
167  $records[] = $array;
168 
169  $returnArray = array("code" => 0, "error" => array(), "record" => $records, "usePhonesInsteadOfMFA" => $usePhonesInsteadOfMFA);
170  } catch(exception $e) {
171  $returnArray = array("code" => $e->getCode(), "error" => array($e->getMessage()), "usePhonesInsteadOfMFA" => false);
172  }
173  return $returnArray;
174 }
175 
176 /**
177  * function saveStatus($dbh, $Cu, $user)
178  *
179  * Saves data for the status tab.
180  *
181  * @param integer $dbh Database handle
182  * @param string $Cu The current credit union
183  * @param string $user Logged in user for audit.
184  *
185  * @return array("sql" => array(), "error" => array(), "record" => array())
186  */
187 function saveStatus($dbh, $Cu, $user) {
188  $parameters = array("BOTTOM_LEVEL" => array("forceSecurity" => "", "forcePassword" => "", "lockAccount" => "", "optin" => "", "ipAddress" => "", "isEmployee" => "",
189  "verifyEmail" => "", "billpay" => "", "password" => "", "forceChangesAmount" => "", "username" => "", "emailAddress" => "", "phones" => "", "phoneWasChanged" => ""));
190  $string = array("filter" => HCUFILTER_INPUT_STRING);
191 
192  HCU_ImportVars($parameters, "BOTTOM_LEVEL", array("forceSecurity" => $string, "forcePassword" => $string, "lockAccount" => $string, "optin" => $string, "ipAddress" => $string,
193  "isEmployee" => $string, "verifyEmail" => $string, "billpay" => $string, "password" => $string, "forceChangesAmount" => $string, "username" => $string,
194  "emailAddress" => $string, "phones" => $string, "phoneWasChanged" => $string));
195 
196  extract($parameters["BOTTOM_LEVEL"]);
197 
198  $data = saveUserData($dbh, $Cu, $username, $forceSecurity, $forcePassword, $lockAccount, $optin, $verifyEmail, $isEmployee, $billpay, $password, $forceChangesAmount, $emailAddress,
199  $ipAddress, $phones, $phoneWasChanged, $user);
200  return $data;
201 }
202 
203 /**
204  * saveUserData($dbh, $cuCode, $userId, $forceSecurity, $forcePassword, $lockAccount, $optin, $verifyEmail, $isEmployee, $billpay, $password, $forceChangesAmount, $emailAddress)
205  *
206  * Saves any changes to the status tab.
207  *
208  * @param integer $dbh The database connection
209  * @param string $cuCode The Credit Union
210  * @param integer $userId The userId of the ${cuCode}user record.
211  * @param boolean $forceSecurity Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
212  * @param boolean $forcePassword Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
213  * @param boolean $lockAccount Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
214  * @param boolean $optin Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
215  * @param boolean $verifyEmail Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
216  * @param boolean $isEmployee Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
217  * @param boolean $billpay Null, true, or false. If true or false, it will be saved. If null, nothing will be done for the column.
218  * @param string $password Null won't save the column. All other values including "" will.
219  * @param integer $forceChangesAmount Null won't save the column. All other number values will.
220  * @param string $emailAddress Null won't save the column. All other values including "" will.
221  * @param string $loggedInUser Needed for audit.
222  *
223  * @return array("code" => integer, "errors" => array(), "data" => array(), "validForAdmin" => boolean, "forceChange" => boolean);
224  * If there are errors, code is non-zero. If $includeSQL is true, then array("sqls" => array()) is also available.
225  * "validForAdmin" -- If there are any illegal characters then the password isn't valid even for admin.
226  * "forceChange" -- If any of the password rules fails, then this will be true.
227  */
228 function saveUserData($dbh, $cuCode, $userId, $forceSecurity, $forcePassword, $lockAccount, $optin, $verifyEmail, $isEmployee, $billpay, $password,
229  $forceChangesAmount, $emailAddress, $ipAddress, $phones, $phoneWasChanged, $loggedInUser) {
230  $forceSecurity = !isset($forceSecurity) || trim($forceSecurity) == "" ? null : strtoupper(trim($forceSecurity)) == "Y";
231  $forcePassword = !isset($forcePassword) || trim($forcePassword) == "" ? null : strtoupper(trim($forcePassword)) == "Y";
232  $lockAccount = !isset($lockAccount) || trim($lockAccount) == "" ? null : strtoupper(trim($lockAccount)) == "Y";
233  $optin = !isset($optin) || trim($optin) == "" ? null : strtoupper(trim($optin)) == "Y";
234  $isEmployee = !isset($isEmployee) || trim($isEmployee) == "" ? null : strtoupper(trim($isEmployee)) == "Y";
235  $billpay = !isset($billpay) || trim($billpay) == "" ? null : strtoupper(trim($billpay)) == "Y";
236  $password = !isset($password) ? null : trim($password);
237  $password = $password == "" ? null : $password;
238  $forceChangesAmount = !isset($forceChangesAmount) ? null : trim($forceChangesAmount);
239  $verifyEmail = !isset($verifyEmail) || trim($verifyEmail) == "" ? null : strtoupper(trim($verifyEmail)) == "Y";
240  $userId = !isset($userId) ? null : trim($userId);
241  $emailAddress = !isset($emailAddress) ? null : trim($emailAddress);
242  $ipAddress = !isset($ipAddress) ? null : trim($ipAddress);
243  $phones = !isset($phones) ? null : trim($phones);
244 
245  $phoneWasChanged = isset($phoneWasChanged) ? $phoneWasChanged == "true" : false;
246 
247  try {
248  $EMAIL_FLAG = GetMsgTxValue('MSGTX_FORCE_EM');
249  $updateTable = array("_action" => "update", "user_id" => $userId);
250  $userHasChanges = false;
251  $saveUserFlags = false;
252 
253  if ($forceChangesAmount == "") {
254  $forceChangesAmount = null;
255  } else {
256  if (!is_numeric($forceChangesAmount)) {
257  throw new exception("Force Changes Amount is not numeric.", 1);
258  }
259  if ($forceChangesAmount < 0 || $forceChangesAmount > 99) {
260  throw new exception("Force Changes needs to be in the range 0-99.", 2);
261  }
262 
263  $updateTable["forceremain"] = intval($forceChangesAmount);
264  $userHasChanges = true;
265  }
266 
267  if ($userId == "") {
268  throw new exception("User Id is required.", 3);
269  }
270 
271  $sql = "select userflags, msg_tx, contact from ${cuCode}user where user_id = $userId";
272  $sth = db_query($sql, $dbh);
273  if (!$sth) {
274  throw new exception("userflags query failed.", 4);
275  }
276 
277  $row = db_fetch_row($sth);
278  $userFlags = isset($row[0]) ? intval($row[0]) & 92 : 0; // sum of all the LOGIN_FAILED flags
279  $originalUserFlags = $userFlags;
280  $msgTxt = isset($row[1]) ? intval($row[1]) : 0;
281  $originalMsgTxt = $msgTxt;
282  $contactId = isset($row[2]) ? intval($row[2]) : 0;
283 
284  $wasForced = false;
285  if (isset($password)) {
286  // You don't validate password for admin EXCEPT for being greater than or equal to four characters long.
287  if (strlen($password) < 4) {
288  throw new exception("Password needs to be four characters or greater", 34);
289  }
290 
291  $hash = password_hash($password, PASSWORD_DEFAULT);
292  $updateTable["passwd"] = "$hash";
293  $updateTable["pwchange"] = DBTIMESTAMP_USENOW;
294  $userHasChanges = true;
295  }
296  if (isset($forceSecurity)) {
297  if ($forceSecurity) {
298  $userFlags |= 2;
299  } else {
300  $userFlags &= ~2;
301  }
302  $saveUserFlags = true;
303  }
304  if (isset($forcePassword)) {
305  $updateTable["forcechange"] = $forcePassword ? "Y" : "N";
306  $userHasChanges = true;
307  }
308  if (isset($lockAccount)) {
309  $sql = "select coalesce(retrylimit,5), coalesce(gracelimit,5) from cuadmin where cu = '$cuCode' limit 1";
310  $sth = db_query($sql,$dbh);
311  if (!$sth) {
312  throw new exception("retrylimit query failed.", 6);
313  }
314  $row = db_fetch_row($sth);
315  $retry = trim($row[0]);
316  $retry = !isset($retry) || $retry == "" ? 5 : $retry;
317  $grace = trim($row[1]);
318  $grace = !isset($grace) || $grace == "" ? 5 : $grace;
319  $updateTable["failedremain"] = $lockAccount ? -1 : $retry;
320  $updateTable["forceremain"] = $grace;
321  }
322  if (isset($optin)) {
323  $updateTable["egenl_flag"] = $optin ? "Y" : "N";
324  $userHasChanges = true;
325  }
326  if (isset($isEmployee)) {
327  $updateTable["employee"] = $isEmployee ? "Y" : "N";
328  $userHasChanges = true;
329  }
330  if (isset($billpay)) {
331  if ($billpay) {
332  $userFlags |= 32;
333  } else {
334  $userFlags &= ~32;
335  }
336  $saveUserFlags = true;
337  }
338  if (isset($forceChangesAmount)) {
339  $updateTable["forceremain"] = intval($forceChangesAmount);
340  $userHasChanges = true;
341  }
342  if (isset($verifyEmail)) {
343  if ($verifyEmail) {
344  $msgTxt |= $EMAIL_FLAG;
345  } else {
346  $msgTxt &= ~$EMAIL_FLAG;
347  }
348  $updateTable["msg_tx"] = $msgTxt;
349  }
350  if (isset($emailAddress)) {
351  $updateTable["email"] = "$emailAddress";
352  }
353  if ($saveUserFlags) {
354  $updateTable["userflags"] = "$userFlags";
355  }
356 
357  if (isset($ipAddress)) {
358  if ($ipAddress !== "") {
359  $ips = explode(";", $ipAddress);
360  foreach($ips as $ip) {
361  $parts = explode(".", $ip);
362  if (count($parts) != 4) {
363  throw new exception("IP Address isn't formatted correctly.", 8);
364  }
365  foreach($parts as $part) {
366  if (!is_numeric($part) || intval($part) > 255) {
367  throw new exception("IP Address isn't formatted correctly.", 9);
368  }
369  }
370  }
371  }
372  $updateTable["ip"] = $ipAddress;
373  }
374 
375  $phoneRecord = array();
376  if ($phoneWasChanged) {
377  $sql = "select uc.phones from ${cuCode}usercontact uc inner join ${cuCode}user u on uc.contact_id = u.contact and u.user_id = $userId";
378  $sth = db_query($sql, $dbh);
379  if (!$sth) {
380  throw new exception("phone query failed.", 33);
381  }
382 
383  $oldPhones = db_num_rows($sth) > 0 ? HCU_JsonDecode(db_fetch_row($sth, 0)[0]) : array();
384 
385  if ($phones == "" || $phones == "[]") {
386  $oldPhones["mobile"]= array();
387  } else {
388  $phones = HCU_JsonDecode($phones);
389  $oldPhones["mobile"] = array();
390  if (!is_array($phones)) {
391  throw new exception("Phones are malformed.", 22);
392  }
393  foreach($phones as $phone) {
394  $value = trim($phone);
395  if ($value != "") {
396  if (!is_numeric($value) || $value <= 0 || strlen($value) != 10) {
397  throw new exception("Phones are malformed.", 25);
398  }
399  $value = substr($value, 0, 3) . "-" . substr($value, 3, 3) . "-" . substr($value, 6);
400  $oldPhones["mobile"][] = $value;
401  }
402  }
403  }
404 
405  $phoneRecord = array("contact_id" => $contactId, "phones" => HCU_JsonEncode($oldPhones));
406  if ($contactId == 0) {
407  $sql = "select nextval('${cuCode}usercontact_contact_id_seq'::regclass)";
408  $sth = db_query($sql, $dbh);
409 
410  if (!$sth) {
411  throw new exception("Nextval query failed.", 26);
412  }
413  $contactId = intval(db_fetch_row($sth, 0)[0]);
414 
415  $updateTable["contact"] = $contactId;
416  $phoneRecord["_action"] = "create";
417  $phoneRecord["contact_id"] = $contactId;
418  $userHasChanges = true;
419  } else {
420  $phoneRecord["_action"] = "update";
421  }
422  }
423 
424  $updateTable = array("user" => array($updateTable));
425  $phoneRecord = array("usercontact" => array($phoneRecord));
426 
427  $envVars = array("cu" => $cuCode);
428 
429  $context = "admin";
430  $script = "userSupport.prg";
431 
432  $sql = "select email from cuadminusers where user_name = '$loggedInUser' and cu = '$cuCode'";
433  $sth = db_query($sql, $dbh);
434  if (!$sth) {
435  throw new exception("email query failed.", 7);
436  }
437  $email = db_fetch_row($sth)[0];
438 
439  if (!db_work ($dbh, HOMECU_WORK_BEGIN)) {
440  throw new exception("begin query failed.", 32);
441  }
442 
443  $userHasChanges = $userHasChanges || $originalUserFlags != $userFlags || $originalMsgTxt != $msgTxt;
444 
445  if ($userHasChanges && DataUserTableUpdate($dbh, $envVars, null, $updateTable, $userId, "U_UPD", $context, $script, "A", "Status Update", $loggedInUser, $email,
446  trim($_SERVER["REMOTE_ADDR"])) === false) {
447  throw new exception("The update failed.", 110);
448  }
449 
450  if ($phoneWasChanged && DataUserTableUpdate($dbh, $envVars, null, $phoneRecord, $userId, "UC_UPD", $context, $script, "A", "Status Update", $loggedInUser, $email,
451  trim($_SERVER["REMOTE_ADDR"])) === false) {
452  throw new exception("Contact update failed.", 133);
453  }
454 
455  if (!db_work($dbh, HOMECU_WORK_COMMIT)) {
456  throw new exception("commit work failed.", 134);
457  }
458 
459  return array("code" => 0, "error" => array(), "wasForced" => $wasForced, "updateInfoBar" => isset($emailAddress) || $phoneWasChanged, "email" => $emailAddress);
460  } catch(exception $e) {
461  if ($e->getCode() >= 100) {
462  db_work($dbh, HOMECU_WORK_ROLLBACK); // Got greater problems if this fails.
463  }
464  return array("code" => $e->getCode(), "error" => array($e->getMessage()));
465  }
466 }
467 
468 /**
469  * function printPage($self, $userId, $readData)
470  * This prints all the script, templates, and HTML necessary to show the status popup.
471  *
472  * @param string $self -- the URL of this script.
473  * @param integer $userId -- the userId of the user.
474  * @param {} $readData -- the results of the read function above.
475  */
476 function printPage($self, $userId, $readData) { ?>
477  <script type="text/javascript">
478  //# sourceURL=status.js
479  <?php printJavascriptHashCode(); ?>
480 
481  var userSupportContents = {};
482  userSupportContents.tabs = null;
483 
484  <?php
485  /**
486  * function init()
487  * This function sets up the tabs and whatnot.
488  */
489  ?>
490  function init() {
491  var previousParameters = {};
492  $("#externalTabWindow").data("preferredHeight", "auto");
493  userSupportContents.tabs = {
494  info: {
495  name: "info",
496  template: $("#infoTemplate").html(),
497  setupValidator: function() {
498  $.homecuValidator.setup({formValidate:'infoForm', formStatusField: 'formValidateDiv'});
499  },
500  init: function(record) {},
501  getSaveParameters: function(setPrevious) {
502  return {};
503  },
504  postChanges: function() {}
505  },
506  security: {
507  name: "security",
508  template: $("#securityTemplate").html(),
509  setupValidator: function() {
510  $.homecuValidator.setup({formValidate:'securityForm', formStatusField: 'formValidateDiv', homecuCustomRules: {
511  validatepassword: function(input) {
512  if (!input.is("[name='password']")) {
513  return true;
514  }
515  var password = $(input).val();
516  if (password.length > 0 && password.length < 4) {
517  $(input).attr("data-validatepassword-msg", "Password must be four or more characters.");
518  return false;
519  }
520  var invalidMatches = password.match(/['"\s]/g);
521  if (invalidMatches != null && invalidMatches.length > 0) {
522  $(input).attr("data-validatepassword-msg", "Password has illegal characters.");
523  return false;
524  }
525  return true;
526  },
527  <?php printMatchPasswords(); ?>
528  }});
529  $.homecuValidator.passwordRules = this.passwordRules;
530  },
531  init: function(record) {
532  var forceChanges = null;
533  $(".fullTab input[type='password']").val(null);
534  $(".lockAccount a").click(function() {
535  var lockAccount = $("#securityForm .lockAccount");
536  if ($(lockAccount).hasClass("currentLocked")) {
537  $(lockAccount).removeClass("currentLocked").addClass("currentUnlocked").removeClass("notRealChange");
538  forceChanges.value(forceChanges.value() == 0 ? record.retry : forceChanges.value());
539  } else {
540  $(lockAccount).removeClass("currentUnlocked").addClass("currentLocked").removeClass("notRealChange");
541  }
542  return false;
543  });
544 
545  this.passwordRules = record.pwdconfig;
546  var thisDoesUnlock = record.failedremain > 0; <?php // If the failedremain is zero (or less), then changing the forcedremain value wouldn't unlock the user. ?>
547  forceChanges = $("#forcePasswordChangeNTB").kendoNumericTextBox({
548  decimals: 0,
549  min: 0,
550  format: "n0",
551  max: 99,
552  spinners: false,
553  change: function() {
554  if (thisDoesUnlock) {
555  var value = this.value();
556  var isLocked = $("#securityForm .lockAccount").hasClass("currentLocked");
557  if (value < 1 && !isLocked) {
558  $("#securityForm .lockAccount").addClass("currentLocked").removeClass("currentUnlocked").addClass("notRealChange");
559  } else if (value >= 1 && isLocked) {
560  $("#securityForm .lockAccount").removeClass("currentLocked").addClass("currentUnlocked").addClass("notRealChange");
561  }
562  }
563  }
564  }).data("kendoNumericTextBox");
565 
566  var isChecked = $("[name='forcePassword']").prop("checked") || $("[name='forceSecurity']").prop("checked");
567  forceChanges.enable(isChecked);
568  var opacity = isChecked ? "1.00" : "0.38";
569  $(".force-descriptor").css({"opacity": opacity});
570 
571  $("[name='forcePassword'],[name='forceSecurity']").click(function() {
572  var isChecked = $("[name='forcePassword']").prop("checked") || $("[name='forceSecurity']").prop("checked");
573  $("[name='forceChangesNTB']").prop("required", isChecked);
574 
575  if (!isChecked) {
576  forceChanges.value($("#forcePasswordChangeNTB").data("previous"));
577  }
578  forceChanges.enable(isChecked);
579  var opacity = isChecked ? "1.00" : "0.38";
580  $(".force-descriptor").css({"opacity": opacity});
581  });
582 
583  $("#userMFAShowBtn").click(function() {
584  if ($(this).text().trim() == "Show") {
585  $(this).text("Hide");
586  $(".userMFASection").show();
587  } else {
588  $(this).text("Show");
589  $(".userMFASection").hide();
590  }
591  });
592  },
593  getSaveParameters: function(setPrevious, alwaysGetValue) {
594  var parameters = {};
595 
596  var lockAccount = $("#securityForm .lockAccount").hasClass("currentLocked") ?
597  ($("#securityForm .lockAccount").hasClass("originalLocked") ? undefined : "Y") :
598  ($("#securityForm .lockAccount").hasClass("originalUnlocked") ? undefined : "N");
599 
600  var notRealChange = $("#securityForm .lockAccount").hasClass("notRealChange");
601 
602  if ($("[name='password']").val().trim() != "")
603  parameters.password = $("[name='password']").val().trim();
604 
605  var forceSecurity = $("[name='forceSecurity']").prop("checked") ? "Y" : "N";
606  var forcePassword = $("[name='forcePassword']").prop("checked") ? "Y" : "N";
607  var forceChangesAmount = $("#forcePasswordChangeNTB").data("kendoNumericTextBox").value();
608 
609  if (!notRealChange && (!alwaysGetValue || (lockAccount != previousParameters.lockAccount))) {
610  parameters.lockAccount = lockAccount;
611  if (setPrevious) {
612  previousParameters.lockAccount = lockAccount;
613  }
614  }
615  if (!alwaysGetValue || forceSecurity != previousParameters.forceSecurity) {
616  parameters.forceSecurity = forceSecurity;
617  if (setPrevious) {
618  previousParameters.forceSecurity = forceSecurity;
619  }
620  }
621 
622  if (!alwaysGetValue || forcePassword != previousParameters.forcePassword) {
623  parameters.forcePassword = forcePassword;
624  if (setPrevious) {
625  previousParameters.forcePassword;
626  }
627  }
628  <?php // On mammoth, forceChangesAmount can be changed without the force password change checked. The result is it doesn't save so effectively this. ?>
629  if ((!alwaysGetValue || forceChangesAmount != previousParameters.forceChangesAmount) && (forcePassword == "Y" || forceSecurity == "Y")) {
630  parameters.forceChangesAmount = forceChangesAmount;
631  if (setPrevious) {
632  previousParameters.forceChangesAmount;
633  }
634  }
635 
636  return parameters;
637  },
638  postChanges: function() {
639  var record = loadTab.data.record[0];
640  record.booleanLockAccount = $("#securityForm .lockAccount").hasClass("currentLocked");
641  record.booleanForceChange = $("[name='forcePassword']").prop("checked");
642  record.booleanForceSecurity = $("[name='forceSecurity']").prop("checked");
643  record.numRemaining = $("#forcePasswordChangeNTB").data("kendoNumericTextBox").value();
644  $(".fullTab input[type='password']").val(null);
645  }
646  },
647  options: {
648  name: "options",
649  template: $("#optionsTemplate").html(),
650  setupValidator: function() {
651  $.homecuValidator.setup({formValidate:'optionsForm', formStatusField: 'formValidateDiv', homecuCustomRules: {
652  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
653  <?php printValidatePhones('optionsForm'); ?>
654  <?php } ?>
655  }});
656  $.homecuValidator.validate();
657  },
658  init: function(record) {
659  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
660  <?php printInitPhoneGrid("optionsForm", "record.phones"); ?>
661  <?php } ?>
662  },
663  getSaveParameters: function(setPrevious, alwaysGetValue) {
664  var parameters = {};
665 
666  var emailAddress = $("[name='emailAddress']").val().trim();
667  var optin = $("[name='booleanOptin']").prop("checked") ? "Y" : "N";
668  var isEmployee = $("[name='booleanEmployee']").prop("checked") ? "Y" : "N";
669  var verifyEmail = $("[name='booleanVerifyEmail']").prop("checked") ? "Y" : "N";
670  var billpay = $("[name='booleanBillPay']").prop("checked") ? "Y" : "N";
671 
672  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
673  var phonesChanged = $("#phoneGrid").data("phonesChanged");
674 
675  if (!alwaysGetValue || phonesChanged) {
676  var phoneData = $("#phoneGrid").data("kendoGrid").dataSource.data();
677  var phoneArray = [];
678  for(var i = 0; i != phoneData.length; i++) {
679  if (!phoneData[i].isAdd) {
680  phoneArray.push(phoneData[i].value.trim().replace(/\D+/g, ""));
681  }
682  }
683  parameters.phones = kendo.stringify(phoneArray);
684  parameters.phoneWasChanged = phonesChanged;
685  }
686  <?php } ?>
687 
688  if (!alwaysGetValue || emailAddress != previousParameters.emailAddress) {
689  parameters.emailAddress = emailAddress;
690  if (setPrevious) {
691  previousParameters.emailAddress = emailAddress;
692  }
693  }
694  if (!alwaysGetValue || optin != previousParameters.optin) {
695  parameters.optin = optin;
696  if (setPrevious) {
697  previousParameters.optin = optin;
698  }
699  }
700  if (!alwaysGetValue || isEmployee != previousParameters.isEmployee) {
701  parameters.isEmployee = isEmployee;
702  if (setPrevious) {
703  previousParameters.isEmployee = isEmployee;
704  }
705  }
706  if (!alwaysGetValue || verifyEmail != previousParameters.verifyEmail) {
707  parameters.verifyEmail = verifyEmail;
708  if (setPrevious) {
709  previousParameters.verifyEmail = verifyEmail;
710  }
711  }
712  if (!alwaysGetValue || billpay != previousParameters.billpay) {
713  parameters.billpay = billpay;
714  if (setPrevious) {
715  previousParameters.billpay = billpay;
716  }
717  }
718 
719  return parameters;
720  },
721  postChanges: function() {
722  var record = loadTab.data.record[0];
723  record.email = $("[name='emailAddress']").val().trim();
724  record.booleanOptin = $("[name='booleanOptin']").prop("checked");
725  record.booleanEmployee = $("[name='booleanEmployee']").prop("checked");
726  record.booleanVerifyEmail = $("[name='booleanVerifyEmail']").prop("checked");
727  record.booleanBillPay = $("[name='booleanBillPay']").prop("checked");
728 
729  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
730  $("#phoneGrid").data("phonesChanged", false);
731  <?php } ?>
732  }
733  },
734  access: {
735  name: "access",
736  template: $("#accessTemplate").html(),
737  setupValidator: function() {
738  $.homecuValidator.setup({formValidate:'accessForm', formStatusField: 'formValidateDiv', homecuCustomRules: {
739  <?php printCheckip(); ?>
740  }});
741  },
742  init: function(record) {
743  var toolbarTemplate = "<a href='\\#' class='k-grid-del k-button checkIfChange " + (record.cuIps.length == 0 ? "k-state-disabled" : "") + "'>Delete Selected</a>";
744 
745  var cuIps = [];
746  for(var i = 0; i != record.cuIps.length; i++) {
747  cuIps.push({ip: record.cuIps[i], checked: false});
748  }
749 
750  var cuIpGrid = $("#ipGrid").kendoGrid({
751  dataSource: {
752  data: cuIps,
753  schema: {
754  id: "ip",
755  fields: {
756  ip: {type: "string"},
757  checked: {type: "boolean"}
758  }
759  }
760  },
761  columns: [
762  {headerTemplate: "<input type='checkbox' class='allCheckbox'>", width: "45px"},
763  {field: "ip", headerTemplate: "IP"}
764  ],
765  rowTemplate: "<tr data-uid='#: uid #'><td class='checkboxTD'><input type='checkbox' class='rowCheckbox' value='#: checked #'>\
766  <td>#: ip #</td></tr>",
767  toolbar: toolbarTemplate,
768  noRecords: {
769  template: "<tr><td colspan='5'><span class='hcu-secondary'><span class='vsgSecondary'>No Records Found</span></span></td></tr>"
770  },
771  scrollable: false
772  }).data("kendoGrid");
773 
774  <?php printCheckboxEvents("#ipGrid", ".k-grid-del"); ?>
775 
776  $("#ipGrid").on("click", ".k-grid-del", function() {
777  var data = cuIpGrid.dataSource.data();
778  data = $.grep(data, function(n,i) { return !n.checked; });
779  if (data.length == 0) {
780  $("#ipGrid .allCheckbox").prop("checked", false);
781  }
782  cuIpGrid.dataSource.data(data);
783  return false;
784  });
785 
786  $("#addCuIpBtn").click(function() {
787  if ($("[name='addCuIpInput']").val().trim() != "" && $("[name='addCuIpInput'].k-invalid:visible").length == 0) {
788  cuIpGrid.dataSource.add({ip: $("[name='addCuIpInput']").val(), checked: false});
789  $("[name='addCuIpInput']").val(null);
790  }
791  return false;
792  });
793  },
794  getSaveParameters: function(setPrevious, alwaysGetValue) {
795  var parameters = {};
796 
797  var ipAddress = "";
798  if ($("#ipGrid").length > 0) {
799  var data = $("#ipGrid").data("kendoGrid").dataSource.data();
800  ipAddress = [];
801  for(var i = 0; i != data.length; i++) {
802  ipAddress.push(data[i].ip.trim());
803  }
804  ipAddress = ipAddress.join(";");
805  }
806 
807  if (!alwaysGetValue || ipAddress != previousParameters.ipAddress) {
808  parameters.ipAddress = ipAddress;
809  if (setPrevious) {
810  previousParameters.ipAddress = ipAddress;
811  }
812  }
813 
814  return parameters;
815  },
816  postChanges: function() {
817  var record = loadTab.data.record[0];
818  var parameters = this.getSaveParameters(record);
819  record.cuIps = parameters.ipAddress.split(";");
820  }
821  }
822  };
823 
824  delete userSupportContents.tabs.access; <?php // #750 At this time the banking side has not implemented the feature. No access for you! ?>
825 
826  <?php printFullTabClickEvents($userId, true); ?>
827  loadTabs(userSupportContents.tabs);
828 
829  <?php // Ensure that the password fields are empty. (They might be non-empty from browser save settings.) ?>
830  $("[name='password']").val(null);
831  $("[name='confirm']").val(null);
832 
833  $.homecuValidator.setup({formValidate:'infoForm', formStatusField: 'formValidateDiv'});
834 
835  if (loadData.error.length > 0) {
836  <?php // Now nothing is done so also disable these functions. ?>
837  $.homecuValidator.displayMessage(loadData.error, $.homecuValidator.settings.statusError );
838  userSupportContents.tabs.info.getSaveParameters = function() { return {}; };
839  userSupportContents.tabs.security.getSaveParameters = function() { return {}; };
840  userSupportContents.tabs.options.getSaveParameters = function() { return {}; };
841  userSupportContents.tabs.info.postChanges = function() {};
842  userSupportContents.tabs.security.postChanges = function() {};
843  userSupportContents.tabs.options.postChanges = function() {};
844  userSupportContents.tabs.info.setupValidator = function() {};
845  userSupportContents.tabs.security.setupValidator = function() {};
846  userSupportContents.tabs.options.setupValidator = function() {};
847  }
848 
849  loadData = undefined;
850  }
851 
852  <?php
853  /**
854  * function tabsCancelLogic(tabs)
855  * What happens when you cancel the tabs?
856  *
857  * @param {} tabs -- the tabs object above.
858  */
859  ?>
860  function tabsCancelLogic(tabs) {
861  $("#externalTabWindow").data("isClosing", true);
862  $("#externalTabWindow").data("kendoWindow").close();
863  $("#externalTabWindow").data("isClosing", false);
864  }
865 
866  <?php
867  /**
868  * function postSaveTabs(tabs)
869  * What happens when after you save the tabs? (Hey, it could have been different you know.)
870  *
871  * @param {} tabs -- the tabs object above.
872  */
873  ?>
874  function postSaveTabs(tabs, data) {
875  if (data.updateInfoBar) {
876  updateInfoBar({email: data.email});
877  }
878 
879  $("#externalTabWindow").data("isClosing", true);
880  $("#externalTabWindow").data("kendoWindow").close();
881  $("#externalTabWindow").data("isClosing", false);
882  }
883 
884  <?php
885  /**
886  * function userSupportDoOnClose()
887  * Hook for the close event on the external card window defined in the userSupportHead file.
888  */
889  ?>
890  function userSupportDoOnClose() {
891  potentiallyCancelChanges(userSupportContents.tabs);
892  $("#externalTabWindow").data("shouldClose", false);
893  }
894 
895  <?php
896  /**
897  * function loadTabs(tabs)
898  * This loads the data for all the tabs.
899  *
900  * @param {} tabs -- the tabs object above.
901  */
902  ?>
903  var loadData = null;
904  function loadTabs(tabs) {
905  var tabTemplate = kendo.template($("#tabTemplate").html());
906  $(".fullTab").html(tabTemplate({tabname: "info"}));
907 
908  loadData = <?php echo HCU_JsonEncode($readData); ?>;
909 
910  if (loadData.error.length == 0) {
911  var oldHash = [];
912  for(var tabname in tabs) {
913  if (tabs.hasOwnProperty(tabname)) {
914  var tab = tabs[tabname];
915  var template = kendo.template(tab.template);
916  $(".tabContents[data-name='" + tab.name + "']").html(template(loadData.record[0]));
917  tab.init(loadData.record[0]);
918  }
919  }
920 
921  for(var tabname in tabs) {
922  if (tabs.hasOwnProperty(tabname)) {
923  var tab = tabs[tabname];
924  var parameters = tab.getSaveParameters(true);
925  tab.oldHash = kendo.stringify(parameters).hashCode();
926  oldHash.push(parameters);
927  }
928  }
929  tabs.oldHash = kendo.stringify(oldHash).hashCode();
930 
931  $(".tabTitles [data-name='info']").addClass("selected");
932  $(".tabContents[data-name='info']").show();
933  tabs.info.setupValidator();
934 
935  var maxWidth = $(".fullTab .tabContents:visible").width();
936  $(".fullTab .tabContents").each(function() {
937  $(this).width(maxWidth);
938  });
939  }
940  }
941 
942  <?php printTabFunctions($self, $userId, "", true); ?>
943 
944  function userSupportDoOnActivate() {
945  var width = $(".kWindowCard").width();
946  $("#externalTabWindow .tabContents").css("width", width <= 710 ? width - 40 : 700);
947  }
948 
949  init();
950 
951  <?php
952  /**
953  * function updateInfoBar(updateArray)
954  * This updates the account encryption and the link for primary account in the infoBar.
955  *
956  * @param {} updateArray -- Array of things changed. From status, this is email and also phone numbers.
957  */
958  ?>
959  function updateInfoBar(updateArray) {
960  var unencrypted = $("#cardContainerDiv").data("unencrypted");
961  $.extend(unencrypted, updateArray);
962 
963  var template = kendo.template($("#userInfoTemplate").html());
964  $("#cardContainerDiv .infoDiv").html(template({unencrypted: unencrypted}));
965  }
966 
967  </script>
968  <script type="text/x-kendo-template" id="infoTemplate">
969  # var lockMode = booleanLockAccount ? "Locked" : "Unlocked"; #
970  <div class="container hcu-all-100"><div class="row">
971  <?php $array = array(
972  "User" => "# if (user_name == '') { # &nbsp; # } else { # #: user_name # # } #",
973  "Name" => "# if (realname == '') { # &nbsp; # } else { # #: realname # # } #",
974  "Last Successful Login" => "# if (lastlogin == '') { # &nbsp; # } else { # #: lastlogin # # } #",
975  "Last Failed Login" => "# if(failedlogin == '') { # &nbsp; # } else { # #: failedlogin # # } #",
976  "Last TXT" => "# if (last_txt == '') { # &nbsp; # } else { # #: last_txt # # } #",
977  "Last Failed Reason" => "# if (failreason == '') { # &nbsp; # } else { # #: failreason # # } #",
978  "Login Tries Before Lockout" => "# if (textLockout == '') { # &nbsp; # } else { # #: textLockout # # } #",
979  "Opt-in list" => "# if (booleanOptin) { # Yes # } else { # No # } #",
980  "CU Employee" => "# if (booleanEmployee) { # Yes # } else { # No # } #",
981  "Lock User" => "<div class='lockAccount original#: lockMode # current#: lockMode # admAlignBottom'><span class='text'></span></div>");
982  printStatusLabelBlock($array); ?>
983  </div></div>
984  </script>
985  <script type="text/x-kendo-template" id="securityTemplate">
986  <div class="container hcu-all-100"><div class="row">
987  # var lockMode = booleanLockAccount ? "Locked" : "Unlocked"; #
988 
989  <div class="col-xs-12">
990  <div class="row wellPadding">
991  <div class="row hcuSpacer">
992  <label class="col-xs-4">Lock User</label>
993  <div class="col-xs-7">
994  <div class="lockAccount original#: lockMode # current#: lockMode # admAlignBottom">
995  <span class="text col-xs-4 col-md-3 hcu-no-padding"></span> <span class="col-xs-5 col-md-1 hcu-no-padding">(<a href="\\#" class="checkIfChange"></a>)</span>
996  </div>
997  </div>
998  </div>
999  </div>
1000  </div>
1001  <div class="col-xs-12"><div class="hcuSpacer"></div></div>
1002  <div class='col-xs-12'>
1003  <div class='well well-sm row'>
1004  <?php printHeader("Password");
1005  dialogPrintInputLine("Enter Password", "", "password", 255, false, "password", true, "matchPasswords nonEmptyIsChange checkIfChange", false);
1006  dialogPrintInputLine("Confirm", "", "confirm", 255, false, "password", true, "matchPasswords", false); ?>
1007  </div>
1008  </div>
1009  <div class="col-xs-12"><div class="hcuSpacer"></div></div>
1010  <div class='col-xs-12'>
1011  <div class='well well-sm row'>
1012  <?php printHeader("Options");
1013  dialogPrintCheckboxLine("forceSecurity", "Force Security", "# if (booleanForceSecurity) { # checked # } #", "checkIfChange", true, true, false);
1014  dialogPrintCheckboxLine("forcePassword", "Force Password", "# if (booleanForceChange) { # checked # } #", "checkIfChange", true, true, false); ?>
1015 
1016  <div class="row hcuSpacer">
1017  <div class="col-xs-4">&nbsp;</div>
1018  <div class="col-xs-7 force-descriptor">Force changes within next&nbsp;
1019  <input id="forcePasswordChangeNTB" name="forceChangesNTB" value="#: forceremain #" style="width: 40px;" class="checkIfChange" data-previous="#: forceremain #">
1020  &nbsp;logins
1021  </div>
1022  <div class="col-xs-1"><span data-for="forceChangesNTB" class="k-invalid-msg"></span></div>
1023  </div>
1024  </div>
1025  </div>
1026  <div class="col-xs-12"><div class="hcuSpacer"></div></div>
1027  <div class="col-xs-12">
1028  <div class="well well-sm row">
1029  <?php printHeader("User MFA (<a href='\\#' id='userMFAShowBtn'>Show</a>)"); ?>
1030  <div class="userMFASection" style="display:none;">
1031  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
1032  # if (!mfaquest.isset) { #
1033  <?php printMessage("N/A"); ?>
1034  # } else { #
1035  <div class="row form-group col-xs-12"><div class="k-block col-xs-12">
1036  <div class="col-xs-12 col-sm-12 hcuSpacer">
1037  <div class="col-xs-12">Requested Secure Access Code Expired.</div>
1038  </div>
1039  <div class="col-xs-12 col-sm-6 hcuSpacer">
1040  <label class="col-xs-12">Code</label>
1041  <div class="col-xs-12 admIndent">#: mfaquest.code #</div>
1042  </div>
1043  <div class="col-xs-12 col-sm-6 hcuSpacer">
1044  <label class="col-xs-12">Expiration Date</label>
1045  <div class="col-xs-12 admIndent # if (mfaquest.expired) { # expired # } #">#: mfaquest.date #</div>
1046  </div>
1047  </div></div>
1048  # } #
1049  <?php } else {
1050  // We want to show the challenge questions and confidence word if they exist.
1051  // This is even if the challenge questions are less than required by the Credit Union.
1052  // This would only occur iff the Credit Union had a higher number of challenge questions set and then later changed to a lower number.
1053  // In the case that the Credit Union is set up for zero challenge questions, add a message in place of the challenge questions.
1054  ?>
1055  # if (mfaquest.length >= 1 || (mfaquest.length == 0 && mfa_num_req == 0)) { #
1056  <?php printStatusLabelBlock(array("Confidence Word" => "#: confidence #")); ?>
1057 
1058  # if (mfaquest.length > 0) { #
1059  <div class="row form-group col-xs-12"><div class="k-block col-xs-12">
1060  # for (var i = 0, count = mfaquest.length; i != count; i++) { #
1061  <div class="col-xs-12 col-sm-6 hcuSpacer">
1062  <label class="col-xs-12">#: mfaquest[i].quest_text #&nbsp;</label>
1063  <div class="col-xs-12 admIndent">#: mfaquest[i].answer #</div>
1064  </div>
1065  # } #
1066  </div></div>
1067  # } else { #
1068  <div class="col-xs-12">
1069  Credit Union is not configured for challenge questions.
1070  </div>
1071  # } #
1072  # } else { #
1073  <?php printMessage("User needs to set up MFA."); ?>
1074  # } #
1075  <?php } ?>
1076  </div>
1077  </div>
1078  </div>
1079  </div></div>
1080  </script>
1081  <script type="text/x-kendo-template" id="optionsTemplate">
1082  <div class="container hcu-all-100"><div>
1083  <?php dialogPrintInputLine("Email Address", "#: email #", "emailAddress", 255, "required data-required-msg=\"Email is required\" data-email-msg=\"Email is invalid\"",
1084  "email", true, "checkIfChange", false);
1085  dialogPrintCheckboxLine("booleanOptin", "Opt-in list", "# if (booleanOptin) { # checked # } #", "checkIfChange", true, true, false);
1086  dialogPrintCheckboxLine("booleanEmployee", "CU Employee", "# if (booleanEmployee) { # checked # } #", "checkIfChange", true, true, false);
1087  dialogPrintCheckboxLine("booleanVerifyEmail", "Verify Email", "# if (booleanVerifyEmail) { # checked # } #", "checkIfChange", true, true, false);
1088  // #3044: billPay option is no longer available
1089  // If necessary, we will need to use perms on profile
1090  // --------------------
1091  // dialogPrintCheckboxLine("booleanBillPay", "Bill Pay", "# if (booleanBillPay) { # checked # } #", "checkIfChange", true, true, false);
1092  ?>
1093 
1094  <?php if ($readData["usePhonesInsteadOfMFA"]) { ?>
1095  <div class="row hcuSpacer"><span class="h3">Phones</span></div>
1096  <div class="row hcuSpacer"><div id="phoneGrid"></div></div>
1097  <input type="hidden" name="validatePhonesHidden">
1098  <?php } ?>
1099  </div></div>
1100  </script>
1101  <script type="text/x-kendo-template" id="accessTemplate">
1102  <div class="container hcu-all-100"><div class="row">
1103  <div class="wellPadding">
1104  <div class="row hcuSpacer">
1105  <label class="col-xs-2">Add IP</label>
1106  <div class="col-xs-9">
1107  <div class="col-xs-9 hcu-no-padding">
1108  <input name="addCuIpInput" class="hcu-all-100 k-input k-textbox" type="text" data-checkip-msg="IP is not valid.">
1109  </div>
1110  <div class="col-xs-3 hcu-no-padding">
1111  <a href='\\#' id="addCuIpBtn" class="k-button hcu-all-100 checkIfChange">Add</a>
1112  </div>
1113  </div>
1114  <div class="col-xs-1">
1115  <span data-for='addCuIpInput' class='k-invalid-msg'></span>
1116  </div>
1117  </div>
1118  <div class="row hcuSpacer">
1119  <div class="col-xs-11">
1120  <div id="ipGrid" class="hcu-all-100 ipGrid"></div>
1121  </div>
1122  </div>
1123  </div>
1124  </div></div>
1125  </script>
1126  <script type="text/x-kendo-template" id="tabTemplate">
1127  # var spacing = "col-xs-3"; var infoSelected = ""; var securitySelected = ""; var optionsSelected = ""; var accessSelected = "";
1128  var tabAsterisk = "<div class='tabAsterisk' style='display:none;'><i class='fa fa-asterisk fa-6'></i></div>";
1129  switch(tabname)
1130  {
1131  case "info":
1132  infoSelected = "selected";
1133  break;
1134  case "security":
1135  securitySelected = "selected";
1136  break;
1137  case "options":
1138  optionsSelected = "selected";
1139  break;
1140  case "access":
1141  accessSelected = "selected";
1142  break;
1143  } #
1144  <div class="hcu-template">
1145  <div class="tabSuccessfulDiv"></div>
1146  <div class="tabTitles">
1147  <div class="#: spacing # #: infoSelected #" data-name="info"><div><i class="fa fa-info-circle fa-6">
1148  <div class="hidden-xs hidden-sm text">&nbsp;Info</div>#= tabAsterisk #</i></div></div>
1149  <div class="#: spacing # #: securitySelected #" data-name="security"><div><i class="fa fa-lock fa-6">
1150  <div class="hidden-xs hidden-sm text">&nbsp;Security</div>#= tabAsterisk #</i></div></div>
1151  <?php // When accessSelected is implemented in banking, remove the "lastChild" class. ?>
1152  <div class="#: spacing # #: optionsSelected # lastChild" data-name="options"><div><i class="fa fa-check-square fa-6">
1153  <div class="hidden-xs hidden-sm text">&nbsp;Options</div>#= tabAsterisk #</i></div></div>
1154  <?php if (false) { // #750 At this time the banking side has not implemented the feature. ?>
1155  <div class="#: spacing # #: accessSelected # lastChild" data-name="access"><div><i class="fa fa-map-marker fa-6">
1156  <div class="hidden-xs hidden-sm text">&nbsp;Access</div>#= tabAsterisk #</i></div></div>
1157  <?php } ?>
1158  </div>
1159  <div>
1160  <form id="infoForm">
1161  <div class="form-group tabContents" data-name="info" style="display:none;"></div>
1162  </form>
1163  <form id="securityForm">
1164  <div class="form-group tabContents" data-name="security" style="display:none;"></div>
1165  </form>
1166  <form id="optionsForm">
1167  <div class="form-group tabContents" data-name="options" style="display:none;"></div>
1168  </form>
1169  <form id="accessForm">
1170  <div class="form-group tabContents" data-name="access" style="display:none;"></div>
1171  </form>
1172  </div>
1173  <div class="hcu-edit-buttons k-state-default tabFooter">
1174  <a class="tabCancelBtn" href="\\#">Cancel</a>
1175  &nbsp;&nbsp;&nbsp;
1176  <a class="tabSaveBtn k-button k-primary" href="\\#">Update</a>
1177  </div>
1178  </div>
1179  </script>
1180 
1181  <div class="container-fluid">
1182  <div class="">
1183  <div id="formValidateDiv" class="k-block k-error-colored formValidateDiv" style="display:none"></div>
1184  </div>
1185  <div class="fullTab"></div>
1186  </div>
1187 <?php }
1188 
1189 /**
1190  * function printStatusLabelBlock($labelArray)
1191  * Prints out a label block
1192  *
1193  * @param array $labelArray -- the label block to display
1194  */
1195 function printStatusLabelBlock($labelArray)
1196 { ?>
1197  <div class="row form-group col-xs-12"><div class="k-block col-xs-12">
1198  <?php foreach($labelArray as $label => $value) { ?>
1199  <div class="col-xs-12 col-sm-6 hcuSpacer">
1200  <label class="col-xs-12"><?php echo $label; ?>&nbsp;</label>
1201  <div class="col-xs-12 admIndent"><?php echo trim(str_replace('\\', '\\\\', $value)); ?></div>
1202  </div>
1203  <?php } ?>
1204  </div></div>
1205 <?php }
1206 
Definition: User.php:7