27 $serviceSkipCredentials =
true;
28 $serviceSkipSecurity =
true;
29 $serviceShowInfo =
false;
30 $serviceLoadMenu =
false;
31 $serviceLiveCheck =
true;
33 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
36 $dmsValuesList = array(
37 'reqfields' =>
'string',
'reqtitles' =>
'string',
'reqtypes' =>
'string',
'member' =>
'digits',
38 'ref1' =>
'string',
'ref2' =>
'string',
'ref3' =>
'string',
'custom1' =>
'string',
'custom2' =>
'string',
39 'mobile1' =>
'string',
'ref5' =>
'string',
'optin'=>
'string',
'action' =>
'string',
"pin" =>
"string",
40 "pfirst" =>
"string",
"pmid" =>
"string",
"plast" =>
"string",
"confirm" =>
"string",
41 "ssn" =>
"string",
"bdate" =>
"string",
"email" =>
"string",
"class" =>
"string",
42 "addr" =>
"string",
"city" =>
"string",
"state" =>
"string",
"zip" =>
"string",
43 "home" =>
"string",
"cell" =>
"string",
"work" =>
"string",
"workext" =>
"string",
44 "password" =>
"string",
"hint" =>
"string",
"previousDate" =>
"string",
45 "agree" =>
"string",
"g-recaptcha-response" =>
"string" );
47 dms_import_v2($HB_ENV,
'HCUPOST', $dmsValuesList);
49 $action = $HB_ENV[
"HCUPOST"][
"action"];
72 function CheckUserMemberValidity($member, $HB_ENV, &$msg, &$userFound) {
74 if (
"$member" !=
"" && is_numeric($member)) {
75 $canActivateUser = CanActivateUser($HB_ENV, $member);
76 $memberFound = $canActivateUser[
"memberExists"];
77 $userFound = $canActivateUser[
"userExists"];
80 if (!$memberFound || $canActivateUser[
"allowEnroll"]) {
84 # CHECK USER PASSWORD NOT NULL 85 if (!$canActivateUser[
"isNullPassword"]) {
86 if ($HB_ENV[
'flagset'] & GetFlagsetValue(
"CU_MEMRESET")) {
87 $msg .= $MC->combo_msg(
"Activate member already exists", HCU_DISPLAY_AS_HTML,
"#reset_link#",
"{$HB_ENV['loginpath']}/hcuResetPwd.prg?{$HB_ENV['cuquery']}");
89 $msg .= $MC->msg(
"Member number already setup", HCU_DISPLAY_AS_HTML) .
"<br>";
93 # CHECK IF USER IS LOCKED 94 if ($canActivateUser[
"isNullPassword"] && $canActivateUser[
"isFailed"]) {
95 $msg .= $MC->msg(
"Account is Locked", HCU_DISPLAY_AS_HTML) .
"<br>";
101 # MEMBER DOES NOT ALLOW ENROLL, ERROR 102 if ($HB_ENV[
'flagset'] & GetFlagsetValue(
"CU_MEMRESET")) {
103 $msg .= $MC->combo_msg(
"Activate member already exists", HCU_DISPLAY_AS_HTML,
"#reset_link#",
"{$HB_ENV['loginpath']}/hcuResetPwd.prg?{$HB_ENV['cuquery']}");
105 $msg .= $MC->msg(
"Member number already setup", HCU_DISPLAY_AS_HTML) .
"<br>";
123 function printMemberThanks($ref3, $newpass, $HB_ENV, $cu, $Flang, $MC, $thanksContent, $member) {
125 $thanksContent[
"notice"][0][
"notice_text"],
127 "#passwd#" => $newpass,
129 "#thankyou#" => $MC->msg(
'Thank You', HCU_DISPLAY_AS_HTML),
130 "#targetString#" => $HB_ENV[
"loginscript"] .
"?cu={$cu}&Flang=$Flang",
131 "#clickhere#" => $MC->msg(
"Click Here", HCU_DISPLAY_AS_HTML),
132 "#memnumber#" => $member
137 "<div class=\"col-xs-12\"><a class=\"k-button hide-for-apps\" href=\"#targetString#\" target=\"_top\">#clickhere#</a></div>",
139 "#targetString#" => $HB_ENV[
"loginscript"] .
"?cu={$cu}&Flang=$Flang",
140 "#clickhere#" => $MC->msg(
"Return To Home Banking", HCU_DISPLAY_AS_HTML)
152 function getDefaultProfileName($pEnv) {
156 $sql =
"select settings::json->>'profile' as default_profile from cuadmin where cu = '$cu'";
157 $sth = db_query($sql, $dbh);
159 throw new Exception(
"default profile query failed.", 2);
161 $dftprofile = db_fetch_row($sth, 0)[0];
184 function addUserTransaction($dbh, $member, $cu, $hash, $ref3, $egenl_flag, $HB_ENV, $MC, $retry, $phoneNumber, $estatements, $accountData =
null) {
186 $logger = $HB_ENV[
"SYSENV"][
"logger"];
187 $sql =
"select user_id, user_name, group_id, email from {$cu}user where user_name = '$member'";
188 $sth = db_query($sql, $dbh);
190 throw new exception(
"User select query failed.", 1);
193 $groupExists =
false;
195 'user_name' => $member,
196 "is_group_primary" =>
true,
199 'failedremain' => $retry,
200 'forcechange' =>
"Y",
202 'egenl_flag' => $egenl_flag,
206 "group_name" =>
"g$member",
210 if ($phoneNumber !=
'') {
212 $phoneNumber = preg_replace(
'/\D+/',
"", $phoneNumber);
213 $phoneNumber =
"(" . substr($phoneNumber, 0, 3) .
") " . substr($phoneNumber, 3, 3) .
"-" . substr($phoneNumber, 6);
214 $phoneArray = array(
"mobile" => Array($phoneNumber));
216 $phoneArray = array(
"mobile" => Array());
218 $phoneTable = array(
"_action" =>
"create",
"phones" => HCU_JsonEncode($phoneArray));
220 if (db_num_rows($sth) > 0) {
221 $row = db_fetch_assoc($sth, 0);
222 $userTable[
"user_id"] = $row[
"user_id"];
223 $userTable[
"_action"] =
"update";
225 if (isset($row[
"group_id"])) {
226 $groupId = $row[
"group_id"];
227 $sql =
"select group_id from ${cu}group where group_id = " . intval($row[
"group_id"]);
228 $sth = db_query($sql, $dbh);
230 throw new exception(
"Group select query failed.", 2);
232 $groupExists = db_num_rows($sth) > 0;
235 $userShort =
"U_UPD";
237 $userTable[
"user_id"] =
"";
238 $userTable[
"_action"] =
"create";
239 $userShort =
"U_ADD";
242 $sql =
"select profile_id from cu_profile where cu = '$cu' and profile_code = '" . getDefaultProfileName($HB_ENV) .
"'";
243 $sth = db_query($sql, $dbh);
245 throw new exception(
"Default profile select query failed.", 5);
247 $profileId = db_fetch_row($sth, 0)[0];
248 $profileId = isset($profileId) ? intval($profileId) : 0;
249 if ($profileId == 0) {
250 throw new exception(
"Group needs to be attached to the default profile which apparently doesn't exist.", 6);
253 $groupTable[
"profile_id"] = $profileId;
256 $sql =
"select nextval('${cu}group_group_id_seq'::regclass)";
257 $sth = db_query($sql, $dbh);
259 throw new exception(
"Nextval query failed.", 3);
261 $groupId = intval(db_fetch_row($sth, 0)[0]);
263 $userTable[
"group_id"] = $groupId;
264 $groupTable[
"group_id"] = $groupId;
265 $groupTable[
"_action"] =
"create";
267 $groupShort =
"G_ADD";
269 $groupTable[
"_action"] =
"update";
270 $groupTable[
"group_id"] = $groupId;
272 $groupShort =
"G_UPD";
283 $HB_ENV[
'Fset'] = $HB_ENV[
'flagset'];
284 $HB_ENV[
'Fset2'] = $HB_ENV[
'flagset2'];
285 $HB_ENV[
'Fset3'] = $HB_ENV[
'flagset3'];
287 if (!isset($accountData)) {
288 $accountData = FindMemberAccounts($HB_ENV, array(
"member" => $member));
289 switch ($accountData[
"code"]) {
291 throw new exception(
"No data was found.", 6);
294 throw new exception($accountData[
"error"], 7);
299 throw new exception(
"There was an internal problem.", 8);
302 }
else if (is_array($accountData)) {
305 if (!HCU_array_key_exists(
"code", $accountData) || $accountData[
"code"] !=
"000") {
306 throw new exception(
"Data is in a bad format.", 12);
309 if (!HCU_array_key_exists(
"data", $accountData) || !HCU_array_key_exists(
"accounts", $accountData[
"data"])) {
310 throw new exception(
"Data is in a bad format.", 13);
313 throw new exception(
"Data is in a bad format.", 11);
316 $sql =
"select ma.accountnumber, ma.primary_user, ma.allowenroll, u.user_id, ma.estmnt_flag from ${cu}memberacct ma 317 left join ${cu}user u on ma.primary_user = u.user_id where trim(ma.accountnumber) = '$member'";
319 $sth = db_query($sql, $dbh);
321 throw new exception(
"Select query failed.", 14);
323 $memberAcctExists = $userExists = db_num_rows($sth) > 0;
324 $changePrimaryUser =
false;
325 $allowEnroll =
false;
326 $changeEstatements =
false;
327 if ($memberAcctExists) {
328 $row = db_fetch_assoc($sth, 0);
329 $userExists = isset($row[
"user_id"]);
330 $changePrimaryUser = intval($row[
"primary_user"]) == 0 || !isset($row[
"user_id"]);
331 $allowEnroll = $row[
"allowenroll"];
332 $changeEstatements = !isset($row[
"estmnt_flag"]) || trim($row[
"estmnt_flag"]) !=
"Y";
335 if ($memberAcctExists && !$allowEnroll) {
336 throw new exception(
"Member account doesn't allow member activation.", 9);
339 $sql =
"select nextval('${cu}usercontact_contact_id_seq'::regclass)";
341 $sth = db_query($sql, $dbh);
344 throw new exception(
"Nextval query failed.", 10);
347 $contactId = intval(db_fetch_row($sth, 0)[0]);
349 $phoneTable[
"contact_id"] = $contactId;
350 $userTable[
"contact"] = $contactId;
351 $groupTable[
"contact"] = $contactId;
353 if (!db_work ($dbh, HOMECU_WORK_BEGIN)) {
354 throw new exception(
"Unable to begin transaction.", 4);
357 $userId = HCU_array_key_exists(
"user_id", $userTable) ? $userTable[
"user_id"] :
null;
358 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, array(
"user" => array($userTable)), $userId, $userShort, $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User', $member,
359 $ref3, $HB_ENV[
'remoteIp']) ===
false) {
360 throw new exception(
"User update failed.", 101);
364 $sql =
"select user_id from ${cu}user where trim(user_name) = '$member'";
366 $sth = db_query($sql, $dbh);
368 throw new exception(
"user_id query failed.", 104);
370 if (db_num_rows($sth) == 0) {
371 throw new exception(
"user_id not found.", 105);
373 $userId = intval(db_fetch_row($sth, 0)[0]);
375 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, array(
"usercontact" => array($phoneTable)), $userId,
"UC_ADD", $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User', $member,
376 $ref3, $HB_ENV[
'remoteIp']) ===
false) {
377 throw new exception(
"User contact failed.", 109);
380 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, array(
"group" => array($groupTable)), $userId, $groupShort, $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User', $member,
381 $ref3, $HB_ENV[
'remoteIp']) ===
false) {
382 throw new exception(
"Group update failed.", 102);
386 $subaccountInfo = $accountData[
"data"][
"accounts"];
391 $processedMbrAcct = Array();
393 foreach($subaccountInfo as $type => $subaccounts) {
394 foreach($subaccounts as $subaccount) {
395 $canWithdraw = HCU_array_key_exists(
"may_withdraw", $subaccount) ? !!$subaccount[
"may_withdraw"] :
396 (HCU_array_key_exists(
"may_addon", $subaccount) ? !!$subaccount[
"may_addon"] :
false);
397 $canDeposit = HCU_array_key_exists(
"may_deposit", $subaccount) ? !!$subaccount[
"may_deposit"] :
398 (HCU_array_key_exists(
"may_payment", $subaccount) ? !!$subaccount[
"may_payment"] :
false);
402 if (($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_CREATE_ACCESS_CONTROL_FROM_XAC")) == 0) {
404 $newAcctNbr = $member;
405 $newAcctSfx = HCU_array_key_value(
"accounttype", $subaccount) .
'#' . HCU_array_key_value(
"tomember", $subaccount);
406 $newAcctCrt = ($type ==
"deposit" ? HCU_array_key_value(
"certnumber", $subaccount) :
'0');
407 $newAcctRec = HCU_array_key_value(
"deposittype", $subaccount) ==
'L' ?
'P' :
'T';
410 if (trim(HCU_array_key_value(
"tomember", $subaccount)) == trim(HCU_array_key_value(
"accountnumber", $subaccount))) {
416 $newAcctNbr = HCU_array_key_value(
"tomember", $subaccount);
417 $newAcctSfx = HCU_array_key_value(
"accounttype", $subaccount);
419 $newAcctRec = HCU_array_key_value(
"deposittype", $subaccount) ==
'L' ?
'L' :
'D';
423 if (!in_array($newAcctNbr, $processedMbrAcct)) {
424 if (!FindMemberAccountExists ($dbh, $HB_ENV[
'cu'], $newAcctNbr)) {
426 $processedMbrAcct[] = $newAcctNbr;
429 $memberRecords = array(
"memberacct" => array(array(
"_action" =>
"create",
"accountnumber" => $newAcctNbr,
"primary_user" => 0,
"allowenroll" =>
true)));
431 if (DataUserTableUpdate($dbh, $HB_ENV,
null, $memberRecords, $userId,
"UM_ADD", HCU_array_key_value(
"platform", $HB_ENV), HCU_array_key_value(
'currentscript', $HB_ENV),
"A",
"Auto Add Member Acct", HCU_array_key_value(
'Cn', $HB_ENV),
'', HCU_array_key_value(
'remoteIp', $HB_ENV)) ===
false) {
432 throw new exception(
"Adding member account relationship failed.", 110);
440 $newAcctNbr = $member;
441 $newAcctSfx = ($type ==
"deposit" ? $subaccount[
"accounttype"] : $subaccount[
'loannumber']);
442 $newAcctCrt = ($type ==
"deposit" ? HCU_array_key_value(
"certnumber", $subaccount) :
'0');
443 $newAcctRec = ($type ==
"deposit" ?
'D' :
'L');
446 $createRecords[] = array(
"_action" =>
"create",
"user_id" => $userId,
"display_name" =>
"",
447 "accountnumber" => $newAcctNbr,
"accounttype" => $newAcctSfx,
448 "certnumber" => $newAcctCrt,
449 "recordtype" => $newAcctRec,
451 "view_balances" => ($type ==
'xa' ?
false :
true),
"view_transactions" => ($type ==
'xa' ?
false :
true),
"int_deposit" => $canDeposit,
452 "ext_deposit" => ($type ==
'xa' ?
false : $canDeposit),
"int_withdraw" => $canWithdraw,
"ext_withdraw" => ($type ==
'xa' ?
false : $canWithdraw),
453 "display_order" => 0);
456 $createRecords = array(
"useraccounts" => $createRecords);
458 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, $createRecords, $userId,
"UA_ADD", $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User', $member,
459 $ref3, $HB_ENV[
'remoteIp']) ===
false) {
460 throw new exception(
"User account add failed.", 106);
463 if ($memberAcctExists) {
464 $memberAcctModify = array(
"_action" =>
"update",
"accountnumber" => $member,
"allowenroll" =>
false);
465 $changePrimaryUser ? $memberAcctModify[
"primary_user"] = $userId :
null;
466 $changeEstatements ? $memberAcctModify[
"estmnt_flag"] = $estatements ?
"Y" :
"N" :
null;
468 $memberAcctModify = array(
"_action" =>
"create",
"accountnumber" => $member,
"primary_user" => $userId,
"estmnt_flag" => $estatements ?
"Y" :
"N",
"allowenroll" =>
false);
471 $memberAcctModify = array(
"memberacct" => array($memberAcctModify));
473 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, $memberAcctModify, $userId, $memberAcctExists ?
"UM_UPD" :
"UM_ADD", $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User',
474 $member, $ref3, $HB_ENV[
'remoteIp']) ===
false) {
475 throw new exception(
"User member modify failed.", 107);
479 array(
"_action" =>
"create",
"accountnumber" => $member,
"user_id" => $userId,
"whichright" =>
"ACCESS"),
480 array(
"_action" =>
"create",
"accountnumber" => $member,
"user_id" => $userId,
"whichright" =>
"ES",
"platform" =>
'["D","A"]'),
481 array(
"_action" =>
"create",
"accountnumber" => $member,
"user_id" => $userId,
"whichright" =>
"BP",
"platform" =>
'["D","A"]'),
482 array(
"_action" =>
"create",
"accountnumber" => $member,
"user_id" => $userId,
"whichright" =>
"RDC",
"platform" =>
'["D","A"]'),
485 $official = array(
"memberacctrights" => $official);
487 if (DataUserTableUpdate($dbh, $HB_ENV, $MC, $official, $userId,
"MAR_ADD", $HB_ENV[
'platform'], $HB_ENV[
'currentscript'],
'U',
'Activate User',
488 $member, $ref3, $HB_ENV[
'remoteIp']) ===
false) {
489 throw new exception(
"Adding rights failed.", 108);
492 if (!db_work ($dbh, HOMECU_WORK_COMMIT)) {
493 throw new exception(
"commit work failed.", 103);
496 }
catch(exception $e) {
497 $logger->error($e->getMessage());
499 if ($e->getCode() >= 100) {
500 db_work ($dbh, HOMECU_WORK_ROLLBACK);
513 $cu = preg_replace(
"/[^A-Za-z0-9]/",
"",$cu);
514 $cu = substr($cu,0,12);
515 $chome = strtolower($cu);
516 $backto =
"/~$chome/mindex.html";
520 $sql =
"select offlinestat, coalesce(retrylimit,5), coalesce(gracelimit,3), 521 livebatch, trim(liveserver), settings::json->>'profile' from cuadmin where cu = '$cu'";
522 $sth = db_query($sql,$dbh);
523 list ($offline,$retry,$grace,$livebatch,$fetcher,$profile) = db_fetch_array($sth,0);
525 $offline = (trim($offline) ==
'' ?
'N' : trim($offline));
526 $profile = $profile ===
null ? null : trim($profile);
528 $self = $_SERVER[
'PHP_SELF'];
530 $gCaptchaResponse = trim( $HB_ENV[
"HCUPOST"][
'g-recaptcha-response'] );
533 $ref1 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref1"]));
534 $ref2 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref2"]));
535 $ref3 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref3"]));
536 $previousDate = htmlentities(trim($HB_ENV[
"HCUPOST"][
"previousDate"]));
537 $custom1 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"custom1"]));
538 $custom2 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"custom2"]));
539 $mobile1 = htmlentities(trim($HB_ENV[
'HCUPOST'][
'mobile1']));
542 $class = HCU_array_key_exists(
"class", $HB_ENV[
"HCUPOST"]) ? strtoupper(trim($HB_ENV[
"HCUPOST"][
"class"])) :
"";
543 $class = $class ==
"B" ?
"B" :
"";
546 $member = htmlentities(trim($HB_ENV[
"HCUPOST"][
"member"]));
547 $pfirst = htmlentities(trim($HB_ENV[
"HCUPOST"][
"pfirst"]));
548 $plast = htmlentities(trim($HB_ENV[
"HCUPOST"][
"plast"]));
549 $ssn = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ssn"]));
550 $bdate = htmlentities(trim($HB_ENV[
"HCUPOST"][
"bdate"]));
551 $email = htmlentities(trim($HB_ENV[
"HCUPOST"][
"email"]));
552 $password = htmlentities(trim($HB_ENV[
"HCUPOST"][
"password"]));
553 $hint = htmlentities(trim($HB_ENV[
"HCUPOST"][
"hint"]));
556 $confirm = htmlentities(trim($HB_ENV[
"HCUPOST"][
"confirm"]));
557 $pin = htmlentities(trim($HB_ENV[
"HCUPOST"][
"pin"]));
560 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
563 <style type=
"text/css">
564 .container-fluid-margin {
568 .k-block > .k-header {
573 .hcu-info-margin, .hcu-error-margin {
577 .hcu-info-padding, .hcu-error-padding {
585 .hcu-container-margin {
590 <?php
if ( isset( $_COOKIE[
"cookie"] ) && $_COOKIE[
"cookie"] ==
"mobile_app_access" ) { ?>
600 $outputContent .= sprintf(
"<FORM id='form1' class='formInputx' ACTION='{$self}?cu={$cu}&Flang=$Flang' METHOD=post > 601 <input type='hidden' name=cu value='$cu'> 602 <input type='hidden' name=action value='activate'>" );
606 if ( strlen( $action ) > 0 ) {
610 if ( !$HB_ENV[
"SYSENV"][
"devmode"]) {
611 if (strlen( $gCaptchaResponse ) ) {
613 $reCaptchaSecret = GetCaptchaSecret();
615 $url =
"https://www.google.com/recaptcha/api/siteverify?secret=$reCaptchaSecret&response=$gCaptchaResponse&remoteip=".$_SERVER[
'REMOTE_ADDR'];
617 $response = file_get_contents($url);
618 $responseObj = HCU_JsonDecode($response);
620 if ( $responseObj[
"success"] ==
false ) {
621 if ( $responseObj[
"error-codes"] ) {
622 $msg .= $MC->msg(
"Error Occurred", HCU_DISPLAY_AS_HTML) .
"<br>";
623 $errorCodes = $responseObj[
"error-codes"];
625 for ( $i = 0; $i < count( $errorCodes ); $i++ ) {
626 $code = $errorCodes[$i];
628 if ( $code ==
"missing-input-secret" ) {
629 $errorString =
"The secret parameter is missing.";
630 }
else if ( $code ==
"invalid-input-secret" ) {
631 $errorString =
"The secret parameter is invalid or malformed.";
632 }
else if ( $code ==
"missing-input-response" ) {
633 $errorString =
"The response parameter is missing.";
634 }
else if ( $code ==
"invalid-input-response" ) {
635 $errorString =
"The response parameter is invalid or malformed.";
637 $errorString =
"Unknown CAPTCHA test failure";
640 $msg .=
" • $errorString<br />";
644 $msg .=
"CAPTCHA test failed.<br>";
649 $msg .=
"Please validate using the CAPTCHA.<br>";
652 if (isset($HB_ENV[
"HCUPOST"][
"reqfields"])) {
654 $reqfields = str_replace(
'"',
'',$HB_ENV[
"HCUPOST"][
"reqfields"]);
655 $reqtitles = str_replace(
'"',
'',$HB_ENV[
"HCUPOST"][
"reqtitles"]);
656 $reqtypes = str_replace(
'"',
'',$HB_ENV[
"HCUPOST"][
"reqtypes"]);
657 $reqfields = explode(
',',$reqfields);
658 $reqtitles = explode(
',',$reqtitles);
659 $reqtypes = explode(
',',$reqtypes);
660 foreach($reqfields as $key => $f) {
662 if(isset($reqtitles[$key])) {
663 $msg .= $reqtitles[$key] .
" " . $MC->msg(
"is a Required Field", HCU_DISPLAY_AS_HTML) .
"<br>";
665 $msg .= $MC->msg(
"Critical Field Missing", HCU_DISPLAY_AS_HTML) .
" ($f) <br>";
668 if(isset($reqtypes[$key])) {
669 # valid types numeric (digits only), date, email, string (no edit) 670 switch($reqtypes[$key]) {
672 if (preg_match(
"/\D/", $$f)) {
673 $msg .= $MC->msg(
'Invalid entry', HCU_DISPLAY_AS_HTML);
674 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
679 if ( $f ==
"ref1" && $class !=
"B" ) {
680 $parts = explode(
"/", $$f );
681 $m = intval($parts[0]);
682 $d = intval($parts[1]);
683 $y = intval($parts[2]);
684 if (!checkdate($m, $d, $y)) {
685 $msg .= $MC->msg(
'Invalid Date Format', HCU_DISPLAY_AS_HTML);
686 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
692 if (!validateEmail($$f)) {
693 $msg .= $MC->msg(
'Email appears invalid', HCU_DISPLAY_AS_HTML);
694 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
699 if(preg_match(
"/[;`]/", $$f)) {
700 $msg .= $MC->msg(
'Invalid entry', HCU_DISPLAY_AS_HTML);
701 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
707 $search = array(
"(",
")",
"-",
" " );
708 $testVal = str_replace( $search,
"", $$f );
709 if ( !ctype_digit( $testVal ) ) {
710 $msg .= $MC->msg(
'Invalid entry', HCU_DISPLAY_AS_HTML);
711 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
716 $msg .= $MC->msg(
'Invalid entry', HCU_DISPLAY_AS_HTML) .
" :(";
717 if (isset($reqtitles[$key])) $msg .=
" - " . $reqtitles[$key];
731 if ( $HB_ENV[
'flagset3'] & $CU3_ENROLL_MIR ) {
738 $activateContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMember",
true);
739 $thanksContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMemberThanks",
true);
741 $disclosureContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupDisclosure", 0);
742 $disclosureTarget = $disclosureContent[
"notice"][0][
"notice_linktarget"];
744 $estatementContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"esTermsStart", 0);
745 $estmtLinkTarget = $estatementContent[
"notice"][0][
"notice_linktarget"];
748 $livebatch = ($HB_ENV[
'live'] == 1 ?
"L" :
"B");
749 if ( $livebatch !=
"L" ||
750 $activateContent[
"status"][
"code"] !=
"000" ||
751 !$activateContent[
"notice"][0][
"notice_id"] ||
752 $thanksContent[
"status"][
"code"] !=
"000" ||
753 !$thanksContent[
"notice"][0][
"notice_id"] ||
756 $serviceErrorTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
757 $serviceErrorMsg = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
759 $serviceErrorCode = 915;
760 require(dirname(__FILE__) .
"/../includes/hcuErrorPage.i");
765 if (isset($action)) {
766 # if $reqfields list is provided, make sure listed fields are present 767 # if $reqtitles list is provided, use provided titles in error message 768 # if $reqtypes list is provided, check input to be specific type 769 # valid types numeric (digits only), date, email, string (no edit) 770 # make sure member number is provided and numeric 771 # make sure member number is for a member who has never logged in 772 # make sure ref3 (email address) is provided & appears valid 773 # make sure at least one of (ref1,ref2) is provided 774 # make sure at least one of (custom1,custom2) is provided 776 $member = htmlentities(trim($HB_ENV[
"HCUPOST"][
"member"]));
777 $optin = htmlentities(trim($HB_ENV[
"HCUPOST"][
"optin"]));
782 if (($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_ALLOW_LEAD_ZEROS")) == 0) {
783 $member = preg_replace(
"/^0*/",
"",$member);
787 CheckUserMemberValidity($member, $HB_ENV, $msg, $userFound);
789 if ( trim($member) ==
"") {
790 $msg .= $MC->msg(
"Member Number Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
792 if (!is_numeric($member)) {
793 $msg .= $MC->msg(
'Member Number Numeric', HCU_DISPLAY_AS_HTML) .
"<br>";
795 if ( trim($ref3) ==
"") {
796 $msg .= $MC->msg(
"EMail Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
798 if (!validateEmail($ref3)) {
799 $msg .= $MC->msg(
'Email appears invalid', HCU_DISPLAY_AS_HTML) .
"<br>";
804 if ( strlen(trim($ref1)) != 4 || ($class !==
"B" && trim($ref2) ==
"") ||
805 trim(
"$custom1$custom2") ==
"") {
806 $msg .= $MC->msg(
"Critical Field Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
810 if (strlen(trim($mobile1)) > 0) {
811 $phones = array(
"mobile" => $mobile1);
815 if (!preg_match(
'/^\(\\d{3}\)[\\s]{0,1}\\d{3}-\\d{4}$/', $mobile1)) {
817 $msg .= $MC->msg(
"enter valid cell", HCU_DISPLAY_AS_HTML) .
"<br>";
820 $egenl_flag = (isset($optin) && $optin ==
'Y' ?
'Y' :
'N');
824 $MIR = GetMemberInfo($HB_ENV, array(
"member" => $member));
826 $statcode = $MIR[
"code"];
827 if ($statcode ==
'000') {
833 $test1 = substr( $MIR[
"data"][
"ssn"], -4 );
835 if ( $validTests && $test1 != $ref1 ) {
840 if ( $class ==
"B" ) {
842 if ( strtoupper( $MIR[
"data"][
"class"]) !=
"B" &&
843 strtoupper( $MIR[
"data"][
"class"]) !=
"T" ) {
850 if ( preg_match(
"/^\\d{4}[-\/]\\d{2}[-\/]\\d{2}$/", $MIR[
"data"][
"dob"] ) ) {
852 $test2 = preg_replace(
"/[^0-9]/",
'', $MIR[
"data"][
"dob"]);
854 }
else if ( preg_match(
"/^\\d{2}[-\/]\\d{2}[-\/]\\d{4}$/", $MIR[
"data"][
"dob"] ) ) {
856 $test2 = substr( $MIR[
"data"][
"dob"], -4 ) . substr( $MIR[
"data"][
"dob"], 0, 2 ) . substr( $MIR[
"data"][
"dob"], 3, 2 );
858 }
else if ( ctype_digit( $MIR[
"data"][
"dob"] ) && strlen( $MIR[
"data"][
"dob"] ) == 8 ) {
860 $yearTest = substr( $MIR[
"data"][
"dob"], 0, 4 );
861 if ( $yearTest > 1900 ) {
862 $test2 = $MIR[
"data"][
"dob"];
869 $testDOBParts = explode(
"/", $ref2 );
870 $testDOB = $testDOBParts[2] . $testDOBParts[0] . $testDOBParts[1];
871 if ( $validTests && $testDOB != $test2 ) {
881 if ($custom1 !=
"") {
882 $validCustom = preg_match(
'/^\D*(\d+)/', $MIR[
"data"][
"address1"] .
" " . trim($MIR[
"data"][
"address2"]), $matches);
884 if (count($matches) > 1) {
885 $test4 = $matches[1];
890 $validTests = $validTests && $test4 == $custom1;
895 if ( strlen( $custom2 ) > 0 ) {
896 $test5_1 = preg_replace(
"/[^0-9]/",
'', $MIR[
"data"][
"homephone"]);
897 $testPhone = preg_replace(
"/[^0-9]/",
'', $custom2);
899 if ( $test5_1 != $testPhone ) {
901 $test5_2 = preg_replace(
"/[^0-9]/",
'', $MIR[
"data"][
"cellphone"]);
902 if ( $test5_2 != $testPhone ) {
910 if ( strlen($mobile1) > 0) {
912 $setUserMobile = $mobile1;
918 # if response is 101, do this stuff 919 $newpass = trim(`/usr/bin/pwgen --numerals --no-capitalize 8 1`);
920 $hash = trim(password_hash($newpass, PASSWORD_DEFAULT));
922 if (addUserTransaction($dbh, $member, $cu, $hash, $ref3, $egenl_flag, $HB_ENV, $MC, $retry, $setUserMobile,
false)) {
925 if ($disclosureContent) {
926 if ($disclosureContent[
"notice"][0][
"notice_id"]) {
928 $HB_ENV[
'HCUPOST'][
'notice_id'] = $disclosureContent[
'notice'][0][
'notice_id'];
929 $HB_ENV[
'HCUPOST'][
'notice_type'] = $disclosureContent[
'notice'][0][
'notice_type'];
930 $HB_ENV[
'HCUPOST'][
'notice_device'] =
"D";
932 $HB_ENV[
"HCUPOST"][
'notice_response'] = array(
"answer" => 1);
933 # not sure if the next two are needed - 934 $HB_ENV[
"HCUPOST"][
'notice_cancel'] =
"0";
935 $HB_ENV[
'HCUPOST'][
'notice_msg_show'] = 1;
938 $sql =
"select user_id from ${cu}user where trim(user_name) = '$member'";
940 $sth = db_query($sql, $dbh);
942 throw new exception(
"user_id query failed.", 104);
944 if (db_num_rows($sth) == 0) {
945 throw new exception(
"user_id not found.", 105);
947 $HB_ENV[
"Uid"] = intval(db_fetch_row($sth, 0)[0]);
949 $noticeUpd = Update_NoticeInfo($dbh, $HB_ENV, $MC);
953 printMemberThanks($ref3, $newpass, $HB_ENV, $cu, $Flang, $MC, $thanksContent, $member);
956 # something went wrong trying to update the database 957 $msg .= $MC->msg(
'Error Occurred updating settings', HCU_DISPLAY_AS_HTML);
958 # should fall through to initial screen w/ message showing 961 $msg .= $MC->msg(
'Authentication Failed', HCU_DISPLAY_AS_HTML) .
". ";
964 # take care of inserting NULL PASSWORD record 965 $sql =
"insert into ${cu}user (user_name, passwd, forcechange, forceremain, failedremain, pwchange) 966 values ('$member', 'NULL PASSWORD','Y',$grace, $retry, now())";
968 # or decrementing retry counter if there already is one. 969 $sql =
"select hcumbrloginfailed('$cu','$member',$MEM_LOGIN_FAILED_PWD)";
971 $sth = db_query($sql,$dbh);
974 # status response was something other than 101 975 $msg = $MC->msg(
"Unable to activate account", HCU_DISPLAY_AS_HTML) .
". ";
978 if ($statcode ==
'001') {
979 $msg .= $MC->msg(
'Authentication Failed', HCU_DISPLAY_AS_HTML) .
". ";
987 $outputContent .= <<<ENDSCRIPT
989 $(document).ready(
function() {
992 $.homecuValidator.settings.formStatusField =
"formStatus";
993 $.homecuValidator.hideMessage();
995 $.homecuValidator.setup({formValidate:
"form1",
996 validateOnClick:
'btnSubmit',
997 formErrorTitle:
"{$MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS)}",
1000 $(
"#btnSubmit").on(
'click',
function(event) {
1001 if ( $.homecuValidator.homecuValidate ===
false ) {
1003 $(
'#formStatus').show();
1004 $(document).scrollTop( 0 );
1005 event.preventDefault();
1007 ShowWaitWindow(
'Loading Data');
1016 $outputContent .= strtr($activateContent[
"notice"][0][
"notice_text"],
1017 array(
"#member#" => $member,
"#ref1#" => $ref1,
"#ref2#" => $ref2,
1018 "#ref3#" => $ref3,
"#custom1#" => $custom1,
"#custom2#" => $custom2,
1019 "#mobile1#" => $mobile1,
"#class#" => $class,
"#estmt_terms_link#" => $estmtLinkTarget,
1020 "#disclosure_link#" => $disclosureTarget,
"#previousDate#" => $previousDate));
1026 }
else if ($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_ENROLL_PIN")) {
1033 $activateContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMemberPin",
true);
1034 $thanksContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMemberThanks",
true);
1036 $disclosureContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupDisclosure", 0);
1037 $disclosureTarget = $disclosureContent[
"notice"][0][
"notice_linktarget"];
1039 $estatementContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"esTermsStart", 0);
1040 $estmtLinkTarget = $estatementContent[
"notice"][0][
"notice_linktarget"];
1043 if ( $activateContent[
"status"][
"code"] !=
"000" || count($activateContent[
"notice"]) == 0 || !$activateContent[
"notice"][0][
"notice_id"] || $thanksContent[
"status"][
"code"] !=
"000" 1044 || !$thanksContent[
"notice"][0][
"notice_id"] || $profile ===
null) {
1046 $serviceErrorTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
1047 $serviceErrorMsg = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
1049 $serviceErrorCode = 915;
1050 require(dirname(__FILE__) .
"/../includes/hcuErrorPage.i");
1055 if (isset($action)) {
1059 if (($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_ALLOW_LEAD_ZEROS")) == 0) {
1060 $member = preg_replace(
"/^0*/",
"",$member);
1064 CheckUserMemberValidity($member, $HB_ENV, $msg, $userFound);
1066 $email = isset($email) ? trim($email) :
"";
1067 $confirm = isset($confirm) ? trim($confirm) :
"";
1068 $pin = isset($pin) ? trim($pin) :
"";
1069 if ( trim($member) ==
"") {
1070 $msg .= $MC->msg(
"Member Number Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1071 }
else if (!is_numeric($member)) {
1072 $msg .= $MC->msg(
'Member Number Numeric', HCU_DISPLAY_AS_HTML) .
"<br>";
1075 if ( $email ==
"") {
1076 $msg .= $MC->msg(
"EMail Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1077 }
else if (!validateEmail($email)) {
1078 $msg .= $MC->msg(
'Email appears invalid', HCU_DISPLAY_AS_HTML) .
"<br>";
1079 }
else if (strcmp($confirm, $email) != 0) {
1080 $msg .= $MC->msg(
"Email Address Mismatch", HCU_DISPLAY_AS_HTML) .
"<br>";
1084 $msg .= $MC->msg(
"new PIN not entered", HCU_DISPLAY_AS_HTML) .
"<br>";
1086 $results = preg_match(
'/[^A-Za-z0-9]/', $pin);
1087 if ($results === 1) {
1088 $msg .= $MC->msg(
"PIN alphanumeric", HCU_DISPLAY_AS_HTML) .
"<br>";
1093 $successful =
false;
1094 $logUnsuccessful =
false;
1096 $verifyResults = VerifyMemberPin($HB_ENV, array(
"member" => $member,
"pin" => $pin));
1098 switch($verifyResults[
"code"]) {
1100 # status response was something other than 101 1101 $msg = $MC->msg(
"Unable to activate account", HCU_DISPLAY_AS_HTML) .
". <br/>";
1104 $msg .= $MC->msg(
'Invalid Login Password', HCU_DISPLAY_AS_HTML) .
". ";
1107 $logUnsuccessful =
true;
1115 # status response was something other than 101 1116 $msg = $MC->msg(
"Unable to activate account", HCU_DISPLAY_AS_HTML) .
". ";
1122 # if response is 101, do this stuff 1123 $newpass = trim(`/usr/bin/pwgen --numerals --no-capitalize 8 1`);
1124 $hash = trim(password_hash($newpass, PASSWORD_DEFAULT));
1126 if (addUserTransaction($dbh, $member, $cu, $hash, $email,
"N", $HB_ENV, $MC, $retry,
'',
false, $verifyResults)) {
1129 if ($disclosureContent) {
1130 if ($disclosureContent[
"notice"][0][
"notice_id"]) {
1132 $HB_ENV[
'HCUPOST'][
'notice_id'] = $disclosureContent[
'notice'][0][
'notice_id'];
1133 $HB_ENV[
'HCUPOST'][
'notice_type'] = $disclosureContent[
'notice'][0][
'notice_type'];
1134 $HB_ENV[
'HCUPOST'][
'notice_device'] =
"D";
1136 $HB_ENV[
"HCUPOST"][
'notice_response'] = array(
"answer" => 1);
1137 # not sure if the next two are needed - 1138 $HB_ENV[
"HCUPOST"][
'notice_cancel'] =
"0";
1139 $HB_ENV[
'HCUPOST'][
'notice_msg_show'] = 1;
1142 $sql =
"select user_id from ${cu}user where trim(user_name) = '$member'";
1144 $sth = db_query($sql, $dbh);
1146 throw new exception(
"user_id query failed.", 104);
1148 if (db_num_rows($sth) == 0) {
1149 throw new exception(
"user_id not found.", 105);
1151 $HB_ENV[
"Uid"] = intval(db_fetch_row($sth, 0)[0]);
1153 $noticeUpd = Update_NoticeInfo($dbh, $HB_ENV, $MC);
1157 printMemberThanks($ref3, $newpass, $HB_ENV, $cu, $Flang, $MC, $thanksContent, $member);
1160 $msg .= $MC->msg(
'Error Occurred updating settings', HCU_DISPLAY_AS_HTML);
1162 }
else if ($logUnsuccessful) {
1163 $msg = $MC->msg(
"Unable to activate account", HCU_DISPLAY_AS_HTML) .
". <br/>";
1164 $msg .= $MC->msg(
'Invalid Login Password', HCU_DISPLAY_AS_HTML) .
". ";
1167 # take care of inserting NULL PASSWORD record 1168 $sql =
"insert into ${cu}user (user_name, passwd, forcechange, forceremain, failedremain, pwchange) 1169 values ('$member', 'NULL PASSWORD','Y',$grace, $retry, now())";
1171 # or decrementing retry counter if there already is one. 1172 $sql =
"select hcumbrloginfailed('$cu','$member',$MEM_LOGIN_FAILED_PWD)";
1174 $sth = db_query($sql,$dbh);
1179 $outputContent .=
"<script> 1180 $(document).ready(function() { 1183 $.homecuValidator.settings.formStatusField = \"formStatus\"; 1184 $.homecuValidator.hideMessage(); 1186 $.homecuValidator.setup({formValidate: \"form1\", 1187 validateOnClick: 'btnSubmit', 1188 formErrorTitle: \"{$MC->msg('Error Occurred', HCU_DISPLAY_AS_JS)}\", 1191 $(\"#btnSubmit\").on('click', function(event) { 1192 if ( $.homecuValidator.homecuValidate === false ) { 1194 $('#formStatus').show(); 1195 $(document).scrollTop( 0 ); 1196 event.preventDefault(); 1198 ShowWaitWindow('Loading Data'); 1206 $outputContent .= strtr($activateContent[
"notice"][0][
"notice_text"], array(
"#member#" => $member,
"#email#" => $email,
"#confirm#" => $confirm,
"#pin#" => $pin,
1207 "#estmt_terms_link#" => $estmtLinkTarget,
"#disclosure_link#" => $disclosureTarget));
1211 $sql =
"select count(*) from cuhavetrans 1212 where cu = '$cu' and trancode = 'MA'";
1213 $sth = db_query($sql,$dbh);
1214 list($maflag) = db_fetch_array($sth,0);
1220 if ( $maflag == 0 ) {
1226 $signupContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupFrm",
true);
1227 $signupThanks = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupThanks",
true);
1229 $signupDisclosure = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupDisclosure", 0);
1231 $signupDisclosureLinkTarget = count($signupDisclosure[
"notice"]) > 0 ? $signupDisclosure[
"notice"][0][
"notice_linktarget"] :
"";
1233 $estatementContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"esTermsStart", 0);
1235 $estmtLinkTarget = count($estatementContent[
"notice"]) > 0 ? $estatementContent[
"notice"][0][
"notice_linktarget"] :
"";
1238 if ($signupContent[
"status"][
"code"] !=
"000" ||
1239 count($signupContent[
"notice"]) == 0 || !$signupContent[
"notice"][0][
"notice_id"] ||
1240 $signupThanks[
"status"][
"code"] !=
"000" ||
1241 count($signupThanks[
"notice"]) == 0 || !$signupThanks[
"notice"][0][
"notice_id"] ||
1242 $signupDisclosure[
"status"][
"code"] !=
"000" ||
1243 !$signupDisclosure[
"notice"][0][
"notice_id"]) {
1245 $serviceErrorTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
1246 $serviceErrorMsg = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
1248 $serviceErrorCode = 915;
1249 require(dirname(__FILE__) .
"/../includes/hcuErrorPage.i");
1253 if ( isset($action) ) {
1254 # if $reqfields list is provided, make sure listed fields are present 1255 # if $reqtitles list is provided, use provided titles in error message 1256 # if $reqtypes list is provided, check input to be specific type 1257 # valid types numeric (digits only), date, email, string (no edit) 1258 # make sure member number is provided and numeric 1259 # make sure member number is for a member who has never logged in 1260 # make sure ref3 (email address) is provided & appears valid 1267 $pmid = HCU_array_key_exists(
"pmid", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"pmid"])) :
"";
1268 $addr = HCU_array_key_exists(
"addr", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"addr"])) :
"";
1269 $city = HCU_array_key_exists(
"city", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"city"])) :
"";
1270 $state = HCU_array_key_exists(
"state", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"state"])) :
"";
1271 $zip = HCU_array_key_exists(
"zip", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"zip"])) :
"";
1272 $home = HCU_array_key_exists(
"home", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"home"])) :
"";
1273 $cell = HCU_array_key_exists(
"cell", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"cell"])) :
"";
1274 $work = HCU_array_key_exists(
"work", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"work"])) :
"";
1275 $workext = HCU_array_key_exists(
"workext", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"workext"])) :
"";
1276 $agree = HCU_array_key_exists(
"agree", $HB_ENV[
"HCUPOST"]) ? htmlentities(trim($HB_ENV[
"HCUPOST"][
"agree"])) :
"";
1281 if (($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_ALLOW_LEAD_ZEROS")) == 0) {
1282 $member = preg_replace(
"/^0*/",
"",$member);
1286 CheckUserMemberValidity($member, $HB_ENV, $msg, $userFound);
1288 if ( trim(
"{$member}") ==
"") {
1289 $msg .= $MC->msg(
"Member Number Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1291 if (!is_numeric($member)) {
1292 $msg .= $MC->msg(
'Member Number Numeric', HCU_DISPLAY_AS_HTML) .
"<br>";
1294 if ( trim(
"{$email}") ==
"") {
1295 $msg .= $MC->msg(
"EMail Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1297 if (!validateEmail($email)) {
1298 $msg .= $MC->msg(
'Email appears invalid', HCU_DISPLAY_AS_HTML) .
"<br>";
1300 if ( trim(
"$pfirst") ==
"" ||
1301 trim(
"$plast") ==
"" ||
1302 trim(
"$ssn") ==
"" ||
1303 trim(
"$bdate") ==
"" ||
1304 trim(
"$agree") ==
"") {
1305 $msg .= $MC->msg(
"Critical Field Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1310 $sslFormsDir =
"/home/{$HB_ENV['chome']}/sslforms/";
1316 $sslFormsFileName =
'Enroll' . date(
'YmdHis') . posix_getpid() .
'.html';
1319 $sql =
"SELECT email 1321 WHERE cu = '{$HB_ENV['Cu']}' 1322 AND role = 'enrollnotify'";
1323 $emRs = db_query($sql, $dbh);
1324 list($notifyEmail) = db_fetch_array($emRs);
1325 db_free_result($emRs);
1328 if ( trim($notifyEmail) ==
'' || !(is_writable($sslFormsDir)) ) {
1329 $msg .= $MC->msg(
'Contact CU', HCU_DISPLAY_AS_RAW) .
"<br>";
1332 if ( empty( $msg )) {
1334 $secureFormDataAry = array();
1335 $secureFormDataAry[] = Array(
'type' =>
'field',
1336 'label' =>
"Submission Date",
1337 'value' =>
"Received on " . date(
"m/d/Y") .
" at " . date(
"H:i T" ) );
1338 $secureFormDataAry[] = Array(
'type' =>
'field',
1339 'label' =>
"Member",
1340 'value' => $member );
1341 $secureFormDataAry[] = Array(
'type' =>
'field',
1342 'label' =>
"Primary Member First Name",
1343 'value' => $pfirst );
1344 $secureFormDataAry[] = Array(
'type' =>
'field',
1345 'label' =>
"Middle Name/Initial",
1347 $secureFormDataAry[] = Array(
'type' =>
'field',
1348 'label' =>
"Last Name",
1349 'value' => $plast );
1350 $secureFormDataAry[] = Array(
'type' =>
'field',
1351 'label' =>
"Last 4 of SSN",
1353 $secureFormDataAry[] = Array(
'type' =>
'field',
1354 'label' =>
"Birth Date",
1355 'value' => $bdate );
1356 $secureFormDataAry[] = Array(
'type' =>
'field',
1357 'label' =>
"Member Email",
1358 'value' => $email );
1359 $secureFormDataAry[] = Array(
'type' =>
'field',
1360 'label' =>
"Address",
1362 $secureFormDataAry[] = Array(
'type' =>
'field',
1363 'label' =>
"City, State Zip",
1364 'value' =>
"$city, $state $zip" );
1365 if ( strlen( $home ) ) {
1366 $secureFormDataAry[] = Array(
'type' =>
'field',
1367 'label' =>
"Home Phone",
1371 if ( strlen( $cell ) ) {
1372 $secureFormDataAry[] = Array(
'type' =>
'field',
1373 'label' =>
"Cell Phone",
1377 if( strlen( $work ) ) {
1380 if ( strlen( $workext ) ) {
1381 $workShow .=
" ($workext)";
1383 $secureFormDataAry[] = Array(
'type' =>
'field',
1384 'label' =>
"Work Phone (Ext)",
1385 'value' =>
"$work ($workext)" );
1388 if (strlen($password)) {
1389 $secureFormDataAry[] = Array(
1391 "label" =>
"Password",
1392 "value" => $password
1396 if (strlen($hint)) {
1397 $secureFormDataAry[] = Array(
1399 "label" =>
"Password Hint",
1403 $secureFormDataAry[] = Array(
'type' =>
'field',
1404 'label' =>
"Member Agreed To Disclosure",
1405 'value' => $agree );
1408 $securePathFileName = $sslFormsDir . $sslFormsFileName;
1411 $emailInfo[
"target"] = $notifyEmail;
1412 $emailInfo[
"reply"] =
"";
1413 $emailInfo[
"subject"] =
"SECURE FORM NOTIFICATION (Enroll)";
1414 $body =
"A secure enrollment form has been submitted to your site. You\n";
1415 $body .=
"can retrieve it in the password protected admin directory.\n";
1416 $body .=
"\n\n{$HB_ENV["Cu
"]}\n";
1417 $emailInfo[
"body"] = $body;
1419 $secureFormTitle =
"Digital Banking Enrollment Request";
1421 $result = PostSecureMessage( $secureFormDataAry, $securePathFileName, $secureFormTitle, $emailInfo, $HB_ENV );
1424 $telluser = $signupThanks[
"notice"][0][
"notice_text"];
1433 $outputContent .= <<<ENDSCRIPT
1435 $(document).ready(
function() {
1436 $.homecuValidator.settings.formStatusField =
"formStatus";
1437 $.homecuValidator.hideMessage();
1439 $.homecuValidator.setup({formValidate:
"form1",
1440 validateOnClick:
'btnSubmit',
1441 formErrorTitle:
"{$MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS)}",
1444 $(
'#btnSubmit').on(
'click',
function (event) {
1445 if ( $.homecuValidator.homecuValidate ===
false ) {
1446 $(
'#formStatus').show();
1447 $(document).scrollTop( 0 );
1448 event.preventDefault();
1456 $telluser = $signupContent[
"notice"][0][
"notice_text"];
1459 $pat = array(
'/#member#/',
'/#pfirst#/',
'/#pmid#/',
1460 '/#plast#/',
'/#ssn#/',
'/#bdate#/',
'/#email#/',
'/#addr#/',
1461 '/#city#/',
'/#state#/',
'/#zip#/',
'/#home#/',
'/#cell#/',
1462 '/#work#/',
'/#workext#/',
'/#password#/',
'/#hint#/',
'/#disclosure_link#/',
'/#estmt_terms_link#/');
1463 $rep = array($member, $pfirst, $pmid, $plast, $ssn, $bdate, $email, $addr, $city, $state, $zip,
1464 $home, $cell, $work, $workext, $password, $hint, $signupDisclosureLinkTarget, $estmtLinkTarget);
1465 $outputContent .= preg_replace( $pat, $rep, $telluser );
1477 $activateContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMember",
true);
1478 $thanksContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"ActivateMemberThanks",
true);
1479 $estatementContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"esTermsStart", 0);
1481 $estmtLinkTarget = $estatementContent[
"notice"][0][
"notice_linktarget"];
1483 $disclosureContent = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"signupDisclosure", 0);
1484 $disclosureTarget = $disclosureContent[
"notice"][0][
"notice_linktarget"];
1487 if ( $livebatch !=
"L" ||
1488 $activateContent[
"status"][
"code"] !=
"000" ||
1489 !$activateContent[
"notice"][0][
"notice_id"] ||
1490 $thanksContent[
"status"][
"code"] !=
"000" ||
1491 !$thanksContent[
"notice"][0][
"notice_id"] ) {
1493 $serviceErrorTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
1494 $serviceErrorMsg = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
1496 $serviceErrorCode = 902;
1497 require(dirname(__FILE__) .
"/../includes/hcuErrorPage.i");
1501 if (isset($action)) {
1502 # if $reqfields list is provided, make sure listed fields are present 1503 # if $reqtitles list is provided, use provided titles in error message 1504 # if $reqtypes list is provided, check input to be specific type 1505 # valid types numeric (digits only), date, email, string (no edit) 1506 # make sure member number is provided and numeric 1507 # make sure member number is for a member who has never logged in 1508 # make sure ref3 (email address) is provided & appears valid 1509 # make sure at least one of (ref1,ref2) is provided 1510 # make sure custom1 is provided 1512 $member = htmlentities(trim($HB_ENV[
"HCUPOST"][
"member"]));
1513 $ref1 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref1"]));
1514 $ref2 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref2"]));
1515 $ref3 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref3"]));
1516 $previousDate = htmlentities(trim($HB_ENV[
"HCUPOST"][
"previousDate"]));
1517 $ref5 = htmlentities(trim($HB_ENV[
"HCUPOST"][
"ref5"]));
1518 $optin = htmlentities(trim($HB_ENV[
"HCUPOST"][
"optin"]));
1523 if (($HB_ENV[
'flagset3'] & GetFlagsetValue(
"CU3_ALLOW_LEAD_ZEROS")) == 0) {
1524 $member = preg_replace(
"/^0*/",
"",$member);
1528 CheckUserMemberValidity($member, $HB_ENV, $msg, $userFound);
1530 if ( trim(
"{$member}") ==
"") {
1531 $msg .= $MC->msg(
"Member Number Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1533 if (!is_numeric($member)) {
1534 $msg .= $MC->msg(
'Member Number Numeric', HCU_DISPLAY_AS_HTML) .
"<br>";
1536 if ( trim(
"{$ref3}") ==
"") {
1537 $msg .= $MC->msg(
"EMail Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1539 if (!validateEmail($ref3)) {
1540 $msg .= $MC->msg(
'Email appears invalid', HCU_DISPLAY_AS_HTML) .
"<br>";
1543 if ( trim(
"$ref1") ==
"" ||
1544 trim(
"$ref2") ==
"" ||
1545 trim(
"$custom1") ==
"") {
1546 $msg .= $MC->msg(
"Critical Field Missing", HCU_DISPLAY_AS_HTML) .
"<br>";
1549 $estmt_flag = isset($ref5) && trim($ref5) !=
"";
1550 $egenl_flag = (isset($optin) && $optin ==
'Y' ?
'Y' :
'N');
1554 # format and submit MA request 1556 $R1 = (trim($ref1) ==
'' ?
'-': urlencode(
"$ref1"));
1557 $R2 = (trim($ref2) ==
'' ?
'-':
"$ref2"); # PostTransactionRequest routine in sAPIAppl.i urlencodes
this one
1558 $R3 =
"$ref3"; # post_packet routine in throtlpkt.i urlencodes
this one
1559 $R4 = (trim($custom1) ==
'' ?
'-': urlencode(
"$custom1"));
1560 $R5 = urlencode(
"$estmt_flag");
1562 $txnValues = array(
"account" => $member,
"txncode" => $Tc,
"email" => $ref3,
"memo" =>
"",
1563 "R1" => $R1,
"R2" => $R2,
"R3" => $R3,
"R4" => $R4,
"amount" =>
"NA" 1567 "member" => $member,
1577 $sendResp = SendTransaction( $HB_ENV,
"MEMBERACTIVATE", $txnValues );
1578 $statcode = $sendResp[
'status'][
'code'];
1579 if ($statcode ==
'999') {
1582 $statreason =
"Unable to activate account";
1585 $statreason = HCU_array_key_value(
"desc", $sendResp[
'data']);
1589 if ($statcode ==
'000' || $statcode ==
'011') {
1590 if ($statcode ==
'011') {
1592 # response 011 means activation was successful, but the core system could not 1593 # enroll the member for e-statements. Send a message to interested folks, 1594 # then continue as if 000 response. 1597 $sql =
"SELECT email FROM cuadmnotify WHERE cu = '$cu' AND role = 'agree'";
1598 $em_rs = db_query($sql, $dbh);
1599 list($agreemail) = db_fetch_array($em_rs, 0);
1600 db_free_result($em_rs);
1602 $agreemail = (
"$agreemail" ==
"" ?
"cuerror@homecu.net" :
"$agreemail");
1605 $notify->mailto = $agreemail;
1606 $notify->replyto = $ref3;
1607 $notify->subject =
"Member eStatement Setting Failed";
1608 $notify->msgbody =
"\tMember eStatement Setting Request\n\n";
1609 $notify->msgbody .=
"Member $member requested auto-activation ";
1610 $notify->msgbody .=
"with eStatement setting $R5. \n\n";
1611 $notify->msgbody .=
"The auto-activation was successful, ";
1612 $notify->msgbody .=
"but eStatement setting failed.\n\n";
1613 $notify->msgbody .=
"Member: {$member}\n";
1614 $notify->msgbody .=
"Member Email: {$ref3}\n";
1615 $notify->msgbody .=
"Member CU: {$cu}\n";
1616 $notify->callingfunction = __FUNCTION__;
1617 $notify->file = __FILE__;
1619 $notify->SendMail();
1622 # if response is 000, do this stuff 1623 $newpass = trim(`/usr/bin/pwgen --numerals --no-capitalize 8 1`);
1624 $hash = trim(password_hash(rtrim($newpass), PASSWORD_DEFAULT));
1626 if (addUserTransaction($dbh, $member, $cu, $hash, $ref3, $egenl_flag, $HB_ENV, $MC, $retry, $custom2, $estmt_flag)) {
1628 printMemberThanks($ref3, $newpass, $HB_ENV, $cu, $Flang, $MC, $thanksContent, $member);
1632 # something went wrong trying to update the database 1633 $msg .= $MC->msg(
'Error Occurred updating settings', HCU_DISPLAY_AS_HTML);
1634 # should fall through to initial screen w/ message showing 1637 # status response was something other than 000, 011 1638 $msg = $MC->msg(
"Unable to activate account", HCU_DISPLAY_AS_HTML) .
". ";
1639 if ($statcode ==
'002') {
1640 $msg .= $MC->msg(
'Authentication Failed', HCU_DISPLAY_AS_HTML) .
". ";
1641 # if status response was 002, take care of inserting NULL PASSWORD record 1644 $sql =
"insert into ${cu}user (user_name, passwd, forcechange, forceremain, failedremain, pwchange) 1645 values ('$member', 'NULL PASSWORD','Y',$grace, $retry, now())";
1647 # or decrementing retry counter if there already is one. 1648 $sql =
"select hcumbrloginfailed('$cu','$member',$MEM_LOGIN_FAILED_PWD)";
1650 $sth = db_query($sql,$dbh);
1651 } elseif ($statcode ==
'001' || $statcode ==
'003') {
1652 $msg .= $MC->msg(
'Invalid Member Number', HCU_DISPLAY_AS_HTML);
1653 } elseif ($statcode !=
'999') {
1654 $msg .=
"$statreason";
1661 $outputContent .= <<<ENDSCRIPT
1663 $(document).ready(
function() {
1664 $.homecuValidator.settings.formStatusField =
"formStatus";
1665 $.homecuValidator.hideMessage();
1667 $.homecuValidator.setup({formValidate:
"form1",
1668 validateOnClick:
'btnSubmit',
1669 formErrorTitle:
"{$MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS)}",
1672 $(
"#btnSubmit").on(
'click',
function(event) {
1673 if ( $.homecuValidator.homecuValidate ===
false ) {
1674 $(
'#formStatus').show();
1675 $(document).scrollTop( 0 );
1676 event.preventDefault();
1686 $outputContent .= strtr($activateContent[
"notice"][0][
"notice_text"],
1687 array(
"#member#" => $member,
"#ref1#" => $ref1,
"#ref2#" => $ref2,
1688 "#ref3#" => $ref3,
"#custom1#" => $custom1,
"#custom2#" => $custom2,
1689 "#mobile1#" => $mobile1,
"#estmt_terms_link#" => $estmtLinkTarget,
1690 "#disclosure_link#" => $disclosureTarget,
"#previousDate#" => $previousDate));
1696 $msg = preg_replace(
'/\r\n|\r|\n/',
'</li><li>', rtrim($msg));
1699 $(document).ready(function() { 1700 $.homecuValidator.displayMessage('$msg', $.homecuValidator.settings.statusError); 1705 if (!$HB_ENV[
"SYSENV"][
"devmode"]) {
1707 $outputContent .= <<< ENDSCRIPT
1709 #recaptcha_area, #recaptcha_table { 1713 #recap .g-recaptcha > div { 1717 @media (min-width: 768px) {
1718 #recap .g-recaptcha > div { 1727 $outputContent .=
"<script src='https://www.google.com/recaptcha/api.js' async defer></script> 1729 <div class='g-recaptcha' data-sitekey='" . GetCaptchaSiteKey() .
"'></div> 1734 $outputContent .=
"<br /> 1735 <div class='container-fluid pinDiv'> 1737 <div class='col-xs-6'> 1738 <input class='k-button hcu-all-100' id='btnSubmit' name='BtnSubmit' type='submit' value='{$MC->msg('Submit', HCU_DISPLAY_AS_RAW)}' /> 1741 <div class='col-xs-6 hide-for-apps'> 1742 <input class='k-button hcu-all-100' type='button' value='{$MC->msg("Cancel
", HCU_DISPLAY_AS_RAW)}' 1743 onClick='document.location=\"{$HB_ENV['loginpath']}/hcuLogin.prg?{$HB_ENV['cuquery']}\"' /> 1747 $outputContent .= <<<ENDSCRIPT
1749 <div
class=
"k-content container-fluid container-fluid-margin">
1750 <div
class=
"col-xs-12 col-md-9 col-lg-6">
1752 <div
class=
"col-xs-6">
1753 <input
class=
'k-button' id=
'btnSubmit' name=
'BtnSubmit' type=
'submit' value=
'{$MC->msg("Submit", HCU_DISPLAY_AS_RAW)}' 1754 style=
"width: 100%;"/>
1757 <div
class=
"col-xs-6 hide-for-apps">
1758 <input
class=
'k-button' type=
'button' value=
'{$MC->msg("Cancel", HCU_DISPLAY_AS_RAW)}' onClick=
'document.location="{$HB_ENV['loginpath
']}/hcuLogin.prg?{$HB_ENV['cuquery
']}"' 1759 style=
"width: 100%;"/>
1767 $outputContent .=
"</form>";
1769 print $outputContent;
1775 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');