12 $serviceSkipCredentials =
true;
13 $serviceSkipSecurity =
true;
14 $serviceShowInfo =
false;
15 $serviceLoadMenu =
false;
17 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
20 $HB_ENV[
"HCUPOST"]= array();
21 $dmsValuesList = array(
'resetLogin'=>
'string',
'resetEmail'=>
'string',
'action'=>
'string');
23 HCU_ImportVars($HB_ENV,
'HCUPOST', $dmsValuesList);
26 $action = HCU_array_key_exists(
"action", $HB_ENV[
"HCUPOST"]) ? $HB_ENV[
"HCUPOST"][
"action"] :
"";
29 $cu = preg_replace(
"/[^A-Za-z0-9]/",
"",$_GET[
'cu']);
30 $cu = substr($cu,0,12);
31 $chome = strtolower($cu);
34 $sql=
"select email from cuadmnotify 35 where role='preset' and cu='$cu'";
36 $sth = db_query($sql,$dbh);
37 list($admEmail) = db_fetch_array($sth,0);
38 $admEmail = preg_replace(
"/ +$/",
"",$admEmail);
39 $admEmail = trim( $admEmail );
43 $sql=
"select email from cuadmnotify 44 where role='presetfrom' and cu='$cu'";
45 $sth = db_query($sql,$dbh);
46 list($admFrom) = db_fetch_array($sth,0);
47 $admFrom = preg_replace(
"/ +$/",
"",$admFrom);
48 $admFrom = trim( $admFrom );
52 $sql=
"select flagset, flagset2, coalesce(retrylimit,5), coalesce(gracelimit,5) 53 from cuadmin where cu='$cu'";
54 $sth = db_query($sql,$dbh);
55 list($flagset, $flagset2, $retry, $grace) = db_fetch_array($sth,0);
59 $featureNotSet =
false;
60 if ( $admFrom ==
"" || ($flagset & $CU_MEMRESET) == 0 ) {
61 $screenTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
62 $screenContents = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
63 $featureNotSet =
true;
64 }
else if ( $action ==
"unlock" ) {
66 # make sure account is valid and email matches here. If not, set msg 68 $userName= $HB_ENV[
"HCUPOST"][
"resetLogin"];
69 $member = strtolower($userName);
70 $member = trim($member);
71 if ( preg_match(
"/[\\\`,\"\s;]/", $member) ) {
72 $msg .= $MC->msg(
"Invalid Username or Password", HCU_DISPLAY_AS_HTML) .
"<br>";
74 $qby=
'lower(user_name) = ';
76 $sql=
"select user_id, trim(user_name), email, passwd, failedremain, 77 userflags & {$MEM_FORCE_RESET}::int4 from {$HB_ENV["cu
"]}user 78 where $qby '" . prep_save($member) .
"'";
79 $sth = db_query($sql,$dbh);
80 $rcount = db_num_rows($sth);
81 list( $saveUserId, $saveUser, $savedEmail, $currPasswd, $fRemain, $fReset) =
82 db_fetch_array($sth,0);
83 $savedEmail = preg_replace(
"/ +$/",
"",$savedEmail);
86 $resetEmail= trim( $HB_ENV[
"HCUPOST"][
"resetEmail"] );
87 $resetEmail = ( validateEmail($resetEmail) ? $resetEmail :
"");
89 if ($rcount == 0 || $resetEmail ==
"" || strtoupper($savedEmail) != strtoupper($resetEmail)) {
90 $msg .= $MC->msg(
"Email Address Mismatch", HCU_DISPLAY_AS_HTML).
"<br>";
93 $msg .= $MC->msg(
"Account Locked by Credit Union", HCU_DISPLAY_AS_HTML) .
"<br>";
97 $msg .= $MC->msg(
"Account Flagged for Security Reset", HCU_DISPLAY_AS_HTML) .
"<br>";
101 if ( trim( $currPasswd ) ==
"NULL PASSWORD" ) {
102 $msg = $MC->msg(
'Never Logged In Reset', HCU_DISPLAY_AS_HTML);
108 $newPass =`/usr/bin/pwgen --numerals --no-capitalize 8 1`;
109 $hash = password_hash(rtrim($newPass), PASSWORD_DEFAULT);
112 $updTable = array(
'user' => array(
114 "_action" =>
"update",
115 "user_id" => $saveUserId
119 $updTable[
'user'][0][
'passwd'] = $hash;
120 $updTable[
'user'][0][
'forcechange'] =
'Y';
121 $updTable[
'user'][0][
'failedremain'] = $retry;
122 $updTable[
'user'][0][
'forceremain'] = $grace;
123 $updTable[
'user'][0][
'pwchange'] = DBTIMESTAMP_USENOW;
125 $updateResults = DataUserTableUpdate($dbh, $HB_ENV, $MC, $updTable, $saveUserId,
'U_UPD', $HB_ENV[
"platform"],
126 $HB_ENV[
"currentscript"],
'U',
"Reset Password", $userName, $savedEmail,
127 $HB_ENV[
"remoteIp"] );
129 if ( $updateResults !==
false ) {
130 db_free_result($sth);
131 # mail new pass ($newpass) to user at $saved_email address 133 $notify->mailto= $savedEmail;
134 $notify->mailfromname = $HB_ENV[
'orgname'];
135 $notify->mailfrom= $admFrom;
136 $notify->replyto= $admFrom;
137 $notify->subject= $MC->msg(
"Home Banking Password", HCU_DISPLAY_AS_RAW);
138 $notify->msgbody = $MC->msg(
"password reset requested", HCU_DISPLAY_AS_RAW) .
"\n\n";
139 $notify->msgbody .= $MC->msg(
"new password is", HCU_DISPLAY_AS_RAW) .
" $newPass\n\n";
140 $notify->msgbody .= $MC->combo_msg(
"Must change password soon", HCU_DISPLAY_AS_RAW,
"#NUMREMAIN#", $grace) .
"\n\n";
141 $notify->msgbody .= date(
"m/d/Y H:i:s T");
142 $notify->callingfunction = __FUNCTION__;
143 $notify->file = __FILE__;
147 # mail msg that user reset pwd to CU at $adm_email address, if configured 148 if ( $admEmail !=
"" ) {
150 $notify->mailto=$admEmail;
151 $notify->replyto=
"support@homecu.net";
152 $notify->subject=
"Password Reset for Member $saveUser";
153 $notify->msgbody =
"Password Reset for Member $saveUser\n\n";
154 $notify->msgbody .=
"A new password has been generated for Member $saveUser\n";
155 $notify->msgbody .=
"and mailed to $savedEmail\n\n";
156 $notify->msgbody .= date(
"m/d/Y H:i:s T");
160 # show "Password changed and mailed" screen 161 $screenTitle = $MC->msg(
"Reset Password", HCU_DISPLAY_AS_HTML );
162 $screenContents = $MC->msg(
"Mailed Password", HCU_DISPLAY_AS_HTML) .
164 $MC->combo_msg(
"Mailed Password Warn Junk",HCU_DISPLAY_AS_HTML,
"#adm_from#",
"$admFrom");
166 $screenTitle = $MC->msg(
"Reset Password", HCU_DISPLAY_AS_HTML );
167 $screenContents = $MC->msg(
"Unable to update password", HCU_DISPLAY_AS_HTML);
170 $screenTitle = $MC->msg(
"Reset Password", HCU_DISPLAY_AS_HTML );
171 $screenContents = $msg;
178 if ( $action !=
"unlock" ) {
179 $resetNoticeAry = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"resetMemberPwd");
182 if ($resetNoticeAry[
'status'][
'code'] ===
'000' && count($resetNoticeAry[
'notice']) > 0 && !$featureNotSet) {
183 $noticeDisplay = $resetNoticeAry[
'notice'][0][
'notice_text'];
185 $screenTitle = $MC->msg(
"Reset Password", HCU_DISPLAY_AS_HTML );
186 $screenContents = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
194 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
201 <style type=
"text/css">
202 .container-fluid-margin {
206 .k-block > .k-header {
211 .hcu-info-margin, .hcu-error-margin {
215 .hcu-info-padding, .hcu-error-padding {
223 .hcu-container-margin {
227 .hcu-
template .hcu-edit-buttons {
232 <?php
if ( isset( $_COOKIE[
"cookie"] ) && $_COOKIE[
"cookie"] ==
"mobile_app_access" ) { ?>
237 <?php
if ( $action ==
"unlock") { ?>
238 <div
class=
"container-fluid container-fluid-margin hcu-template">
239 <div
class=
'well well-sm col-xs-12 col-md-8 col-lg-6'>
241 <h3><?php echo $screenTitle; ?></h3>
243 <div
class=
'k-block k-info-colored hcu-info-margin'>
244 <div
class=
"hcu-info-padding">
245 <span><?php print $screenContents; ?></span>
248 <div
class=
"hcu-edit-buttons k-state-default">
249 <a href=
"##" id=
"btnStartOver"><?php echo $MC->msg(
'Start Over', HCU_DISPLAY_AS_HTML) ?></a>
251 <a href=
"##" id=
"btnBack" class=
"k-button k-primary hide-for-apps">
252 <i
class=
"fa fa-check fa-lg"></i><?php echo $MC->msg(
'Log In', HCU_DISPLAY_AS_HTML) ?>
262 <div
class=
"container-fluid container-fluid-margin hcu-template">
263 <div
class=
'well well-sm col-xs-12 col-md-8 col-lg-6'>
264 <h3><?php echo $MC->msg(
"Reset Password", HCU_DISPLAY_AS_HTML); ?></h3>
266 <form
class=
'formInputx' id=
'formReset' name=
'formReset' method=
"post">
267 <input type=hidden name=
'action' value=
'unlock'>
269 <?php
if ( strlen( $noticeDisplay ) ) { ?>
270 <div
id=
'noticeContent' class=
'k-block k-info-colored hcu-info-margin'>
271 <div
class=
"hcu-info-padding">
272 <span><?php print $noticeDisplay; ?></span>
284 if (($HB_ENV[
'flagset2'] & $GLOBALS[
'CU2_ALIAS_REQ']) > 0 || (($HB_ENV[
'flagset2'] & $GLOBALS[
'CU2_ALIAS_OK']) > 0)) {
287 $hbLoginText = $MC->msg(
'Login ID', HCU_DISPLAY_AS_HTML);
288 $hbLoginValMsg = $MC->msg(
'Please enter your login id', HCU_DISPLAY_AS_HTML);
289 $hbLoginHelp =
"<span class='fa fa-question-circle-o' id='loginTip'></span>";
293 $hbLoginText = $MC->msg(
'Account Number', HCU_DISPLAY_AS_HTML);
294 $hbLoginValMsg = $MC->msg(
'Please enter your account number', HCU_DISPLAY_AS_HTML);
299 <fieldset
class=
"row">
300 <div
class=
"col-xs-12 col-sm-12 hcu-container-margin">
301 <label
for=
"resetLogin">
302 <?php echo $hbLoginText; ?>: <?php echo $hbLoginHelp ?>
304 <input type=
"text" id=
"resetLogin" name=
"resetLogin" class=
"k-textbox hcu-full-width" value=
"" required
305 placeholder=
"<?php echo $hbLoginValMsg; ?>" 306 data-required-msg=
"<?php echo $MC->msg('Username Required', HCU_DISPLAY_AS_HTML) ?>."/>
309 <div
class=
"col-xs-12 col-sm-12 hcu-container-margin">
310 <label
for=
"resetEmail"><?php echo $MC->msg(
'Email Address', HCU_DISPLAY_AS_HTML); ?>:
311 <span
class=
"fa fa-question-circle-o" id=
"emailTip"></span>
313 <input type=
"email" id=
"resetEmail" name=
"resetEmail" class=
"k-textbox hcu-full-width" value=
"" required
314 placeholder=
"<?php echo $MC->msg('Email Address', HCU_DISPLAY_AS_HTML); ?>" 315 data-required-msg=
"<?php echo $MC->msg('EMail Missing', HCU_DISPLAY_AS_HTML) ?>." 316 data-email-msg=
"<?php echo $MC->msg('Email appears invalid', HCU_DISPLAY_AS_HTML); ?>"/>
323 <div
class=
"hcu-edit-buttons k-state-default">
324 <a href=
"##" id=
"btnBack" class=
"hide-for-apps"><?php echo $MC->msg(
'Back', HCU_DISPLAY_AS_HTML) ?></a>
326 <a href=
"##" id=
"btnReset" class=
"k-button k-primary">
327 <i
class=
"fa fa-check fa-lg"></i><?php echo $MC->msg(
'Reset Password', HCU_DISPLAY_AS_HTML) ?>
338 <script type=
"text/javascript">
339 $(document).ready(
function() {
342 homecuTooltip.bind({ emailTip:
"<?php echo $MC->msg("Match Saved Email
", HCU_DISPLAY_AS_JS); ?>" });
344 <?php
if ( isset($hbLoginHelp) && strlen( $hbLoginHelp ) > 0 ) { ?>
346 homecuTooltip.bind({ loginTip:
"<?php echo $MC->msg("Username NoBypass Unlock
", HCU_DISPLAY_AS_JS); ?>" });
350 if ($(
"#formReset").length > 0) {
351 $.homecuValidator.setup({
352 formValidate:
'formReset',
353 formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>",
354 formStatusField:
'formStatus',
355 validateOnClick:
'btnReset'});
358 $(
'#btnReset').click(
function() {
359 if ($.homecuValidator.validate()) {
360 ShowWaitWindow(
'Loading Data');
361 $(
'#formReset').submit();
365 $(
'#formReset').keypress(
function(e) {
366 if (e.which === 13) {
367 $(
'#btnReset').trigger(
'click');
373 <?php
if($action ==
"error") { ?>
374 $.homecuValidator.displayMessage(<?php echo HCU_JsonEncode($screenContents); ?>, $.homecuValidator.settings.statusError);
377 $(
'#btnBack').click(
function() {
378 window.location =
'<?php echo $HB_ENV['loginscript
'] . "?" . $HB_ENV['cuquery
']; ?>';
381 $(
'#btnStartOver').click(
function() {
382 window.location =
'<?php echo $HB_ENV['loginpath
'] . "/" . $HB_ENV["currentscript"] . "?" . $HB_ENV['cuquery
']; ?>';
393 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');