10 $serviceShowInfo =
true;
11 $serviceLoadMenu =
true;
12 $serviceShowMenu =
true;
15 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
21 PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC);
29 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
35 $specialCharacters = Get_PwdSpecialCharacters();
38 $pwdConfigAry = Get_PwdRules( $dbh, $HB_ENV );
41 $hasPwdRequirements = 1;
42 if ( $hasPwdRequirements ) {
43 $pwdConfigJSON = json_encode( $pwdConfigAry );
45 $pwdConfigJSON =
"{}";
49 $pwdRequirements = array();
50 if (HCU_array_key_value(
"len", $pwdConfigAry) > 0) {
51 $text = ( $pwdConfigAry[
"len"] > 1 ) ? $MC->msg(
"Characters", HCU_DISPLAY_AS_HTML) : $MC->msg(
"Character", HCU_DISPLAY_AS_HTML);
52 $pwdRequirements[] = array(
"which"=>
"len",
"text"=>
"{$pwdConfigAry["len
"]} {$text}" );
54 if (HCU_array_key_value(
"upper", $pwdConfigAry) > 0) {
55 $text = ( $pwdConfigAry[
"upper"] > 1 ) ? $MC->msg(
"UPPER letters", HCU_DISPLAY_AS_HTML) : $MC->msg(
"UPPER letter", HCU_DISPLAY_AS_HTML);
56 $pwdRequirements[] = array(
"which"=>
"upper",
"text"=>
"{$pwdConfigAry["upper
"]} {$text}" );
58 if (HCU_array_key_value(
"lower", $pwdConfigAry) > 0) {
59 $text = ( $pwdConfigAry[
"lower"] > 1 ) ? $MC->msg(
"lower letters", HCU_DISPLAY_AS_HTML) : $MC->msg(
"lower letter", HCU_DISPLAY_AS_HTML);
60 $pwdRequirements[] = array(
"which"=>
"lower",
"text"=>
"{$pwdConfigAry["lower
"]} {$text}" );
62 if (HCU_array_key_value(
"letter", $pwdConfigAry) > 0) {
64 $text = $MC->msg(
"Letter", HCU_DISPLAY_AS_HTML);
65 $pwdRequirements[] = array(
"which"=>
"letter",
"text"=>
"{$pwdConfigAry["letter
"]} {$text}" );
67 if (HCU_array_key_value(
"spec", $pwdConfigAry) > 0) {
68 $text = ( $pwdConfigAry[
"spec"] > 1 ) ? $MC->msg(
"Special characters", HCU_DISPLAY_AS_HTML) : $MC->msg(
"Special character", HCU_DISPLAY_AS_HTML);
69 $pwdRequirements[] = array(
"which"=>
"spec",
"text"=>
"{$pwdConfigAry["spec
"]} {$text} <span class='fa fa-question-circle-o' style='color: #333' id='specialTip'></span>" );
71 if (HCU_array_key_value(
"digit", $pwdConfigAry) > 0) {
72 $text = ( $pwdConfigAry[
"digit"] > 1 ) ? $MC->msg(
"Numbers", HCU_DISPLAY_AS_HTML) : $MC->msg(
"Number", HCU_DISPLAY_AS_HTML);
73 $pwdRequirements[] = array(
"which"=>
"digit",
"text"=>
"{$pwdConfigAry["digit
"]} {$text}" );
77 $pwdHelpAry = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"D",
"pwdRules", FALSE);
80 if ( $pwdHelpAry[
"status"][
"code"] ==
"000" && HCU_array_key_exists(
'0', $pwdHelpAry[
"notice"]) && HCU_array_key_exists(
'notice_id', $pwdHelpAry[
"notice"][0]) ) {
81 $noticeOption = $pwdHelpAry[
'notice'][0];
83 $noticeOptions = Array (
84 'docsid' => $noticeOption[
'notice_id'],
85 'docstype' => $noticeOption[
'notice_type'],
88 'expireTime' => mktime() + 86400
91 $encryptedDocDetails= HCU_PayloadEncode($HB_ENV[
'Cu'], $noticeOptions);
94 $pwdHelpURL = $HB_ENV[
'homebankingpath'] .
'/hcuViewNotice.prg?cu=' . $HB_ENV[
'cu'] .
'&x=' . urlencode($encryptedDocDetails);
98 <script type=
"text/javascript">
99 function validateForm() {
101 var formValid = $.homecuValidator.validate();
104 var testStepThree =
false;
105 var testVal = $(
"#profilePasswordNew1").val();
106 var testLength = testVal.length >= pwdRequirements[
'len'];
108 var testUpper = RegExp(
"([A-Z].*){" + pwdRequirements[
'upper'] +
"}");
109 testUpper = testUpper.test(testVal);
111 var testLower = RegExp(
"([a-z].*){" + pwdRequirements[
'lower'] +
"}");
112 testLower = testLower.test(testVal);
114 var testDigit = RegExp(
"(\\d.*){" + pwdRequirements[
'digit'] +
"}");
115 testDigit = testDigit.test(testVal);
117 var testSpecial = pwdSpecial.join(
"|");
118 testSpecial = testSpecial.replace(/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&');
119 testSpecial = RegExp(
"([" + testSpecial +
"].*){" + pwdRequirements[
'spec'] +
"}");
120 testSpecial = testSpecial.test(testVal);
122 var testLetter = testUpper && testLower;
124 if (pwdRequirements[
'len'] > 0 && testLength ==
false) { testStepThree =
false; }
125 else if (pwdRequirements[
'upper'] > 0 && testUpper ==
false) { testStepThree =
false; }
126 else if (pwdRequirements[
'lower'] > 0 && testLower ==
false) { testStepThree =
false; }
127 else if (pwdRequirements[
'digit'] > 0 && testDigit ==
false) { testStepThree =
false; }
128 else if (pwdRequirements[
'spec'] > 0 && testSpecial ==
false) { testStepThree =
false; }
129 else if (pwdRequirements[
'letter'] > 0 && testLetter ==
false) { testStepThree =
false; }
130 else { testStepThree =
true; }
132 var stepThreeError =
"<?php echo $MC->msg('New password requirements', HCU_DISPLAY_AS_HTML) ?>";
133 var errors = $.homecuValidator.homecuKendoValidator.errors();
137 var index = $.inArray(stepThreeError, errors);
139 errors.splice(index, 1);
143 if (!testStepThree) {
144 errors.push(stepThreeError);
145 $.homecuValidator.displayMessage(errors, $.homecuValidator.settings.statusError);
148 return formValid && testStepThree;
154 if ( strlen( $pwdHelpURL ) > 0 ) {
156 ShowNotice(
"<?php echo $pwdHelpURL ?>" );
162 var pwdRequirements = <?php echo $pwdConfigJSON; ?>;
163 var pwdSpecial = <?php echo HCU_JsonEncode(explode(
",", $specialCharacters )); ?>;
164 $(document).ready(
function() {
167 function ShowStatus( statusMessage ) {
168 $.homecuValidator.settings.formStatusField =
"formStatus";
169 $.homecuValidator.settings.formInfoTitle =
"";
170 $.homecuValidator.displayMessage(statusMessage);
173 function ClearStatus( ) {
174 $.homecuValidator.settings.formStatusField =
"formStatus";
175 $.homecuValidator.settings.formInfoTitle =
"";
176 $.homecuValidator.displayMessage(
null);
179 $(
"#btnUpdate").click(
function() {
180 if ( validateForm() ) {
183 old: $(
"#profilePasswordCurr").val(),
184 new1: $(
"#profilePasswordNew1").val(),
185 new2: $(
"#profilePasswordNew2").val(),
191 url:
"hcuProfile.data?cu=<?php echo $HB_ENV["cu
"] ?>",
194 beforeSend:
function( xhr ) {
198 .done(
function( data, textStatus, jqXHR ) {
199 if ( data && data.homecuErrors ) {
201 $.homecuValidator.displayMessage(data.homecuErrors, $.homecuValidator.settings.statusError);
203 if ( data && data.homecuInfo && (data.homecuInfo.message.length > 0) ) {
204 ShowStatus( data.homecuInfo.message );
209 if ( data.homecuData &&
210 data.homecuData.homecuKey &&
211 (data.homecuData.homecuKey.length > 0) ) {
212 var appInfo = JSON.stringify( { deviceKey: data.homecuData.homecuKey,
213 newPassword: $(
"#profilePasswordNew1").val() } );
215 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
216 AndroidController.notifyCommand(
"NEW_DEVICE_KEY", appInfo);
217 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
220 cmd:
"NEW_DEVICE_KEY",
224 window.webkit.messageHandlers.interOp.postMessage(postObject);
229 $(
"#profilePasswordCurr").val(
"");
230 $(
"#profilePasswordNew1").val(
"");
231 $(
"#profilePasswordNew2").val(
"");
234 $(
"#len .fa").removeClass(
"fa-check").addClass(
"fa-times");
235 $(
"#len").css(
"color",
"red");
236 $(
"#upper .fa").removeClass(
"fa-check").addClass(
"fa-times");
237 $(
"#upper").css(
"color",
"red");
238 $(
"#lower .fa").removeClass(
"fa-check").addClass(
"fa-times");
239 $(
"#lower").css(
"color",
"red");
240 $(
"#letter .fa").removeClass(
"fa-check").addClass(
"fa-times");
241 $(
"#letter").css(
"color",
"red");
242 $(
"#spec .fa:first").removeClass(
"fa-check").addClass(
"fa-times");
243 $(
"#spec").css(
"color",
"red");
244 $(
"#digit .fa").removeClass(
"fa-check").addClass(
"fa-times");
245 $(
"#digit").css(
"color",
"red");
249 if ( $HB_ENV[
"platform"] ==
"APP" || $HB_ENV[
"platform"] ==
"ADA" ) {
250 $paramsForApps = array(
"script" =>
"ProfilePwd" );
251 $paramsJSON = HCU_JsonEncode($paramsForApps);
253 var appInfo =
'<?php echo $paramsJSON; ?>';
255 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
256 AndroidController.notifyCommand(
"PROFILE_UPDATE", appInfo);
257 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
260 cmd:
"PROFILE_UPDATE",
264 window.webkit.messageHandlers.interOp.postMessage(postObject);
273 .fail(
function(jqXHR, textStatus, errorThrown) {
275 $.homecuValidator.displayMessage(textStatus, $.homecuValidator.settings.statusError);
277 .always(
function(jqXHR, textStatus, errorThrown) {
285 $.homecuValidator.setup({formValidate:
"formProfile",
286 formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>"});
289 reenterTip:
"<?php echo $MC->msg("Tip Re-enter Password
", HCU_DISPLAY_AS_JS); ?>",
290 newTip1:
"<?php echo $MC->msg( "New password requirements
", HCU_DISPLAY_AS_JS ) . "<br />
" . $MC->msg('Case Sensitive', HCU_DISPLAY_AS_JS); ?>",
291 newTip2:
"<?php echo $MC->msg("Enter NEW password again to confirm
", HCU_DISPLAY_AS_JS); ?>" 294 function revertPassword() {
295 $(
"#showPasswordText").val(
"" );
296 $(
"#showPasswordText").css(
"display",
"none" );
297 $(
"#profilePasswordNew1").css(
"display",
"inline" );
300 $(
"#showPassword").click(
function() {
301 $(
"#showPasswordText").val( $(
"#profilePasswordNew1").val() )
302 $(
"#profilePasswordNew1").css(
"display",
"none" );
303 $(
"#showPasswordText").css(
"display",
"inline" );
304 setTimeout(revertPassword, 1000);
308 if ( $hasPwdRequirements ) {
312 specialTip:
"<?php echo $MC->msg("Special characters allowed
", HCU_DISPLAY_AS_JS); ?>: <?php echo implode( " ", explode( ",
", $specialCharacters ) ); ?>" 315 $(
"#profilePasswordNew1").keyup(
function () {
317 var testVal = $(
"#profilePasswordNew1").val();
318 var testLength =
false;
319 var testUpper =
false;
320 var testLower =
false;
321 var testDigit =
false;
322 var testSpeciel =
false;
323 var testLetter =
false;
325 testLength = testVal.length >= pwdRequirements[
'len'];
327 testUpper = RegExp(
"([A-Z].*){" + pwdRequirements[
'upper'] +
"}");
328 testUpper = testUpper.test(testVal);
330 testLower = RegExp(
"([a-z].*){" + pwdRequirements[
'lower'] +
"}");
331 testLower = testLower.test(testVal);
333 testDigit = RegExp(
"(\\d.*){" + pwdRequirements[
'digit'] +
"}");
334 testDigit = testDigit.test(testVal);
336 testSpecial = pwdSpecial.join(
"|");
337 testSpecial = testSpecial.replace(/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&');
338 testSpecial = RegExp(
"([" + testSpecial +
"].*){" + pwdRequirements[
'spec'] +
"}");
339 testSpecial = testSpecial.test(testVal);
341 testLetter = testUpper && testLower;
344 if (pwdRequirements[
"len"] > 0) {
346 $(
"#len .fa").removeClass(
"fa-times").addClass(
"fa-check");
347 $(
"#len").css(
"color",
"green");
349 $(
"#len .fa").removeClass(
"fa-check").addClass(
"fa-times");
350 $(
"#len").css(
"color",
"red");
354 if ( pwdRequirements[
"upper"] > 0 ) {
356 $(
"#upper .fa").removeClass(
"fa-times").addClass(
"fa-check");
357 $(
"#upper").css(
"color",
"green");
359 $(
"#upper .fa").removeClass(
"fa-check").addClass(
"fa-times");
360 $(
"#upper").css(
"color",
"red");
364 if ( pwdRequirements[
"lower"] > 0 ) {
366 $(
"#lower .fa").removeClass(
"fa-times").addClass(
"fa-check");
367 $(
"#lower").css(
"color",
"green");
369 $(
"#lower .fa").removeClass(
"fa-check").addClass(
"fa-times");
370 $(
"#lower").css(
"color",
"red");
374 if ( pwdRequirements[
"digit"] > 0 ) {
376 $(
"#digit .fa").removeClass(
"fa-times").addClass(
"fa-check");
377 $(
"#digit").css(
"color",
"green");
379 $(
"#digit .fa").removeClass(
"fa-check").addClass(
"fa-times");
380 $(
"#digit").css(
"color",
"red");
384 if ( pwdRequirements[
"spec"] > 0 ) {
386 $(
"#spec .fa:first").removeClass(
"fa-times").addClass(
"fa-check");
387 $(
"#spec").css(
"color",
"green");
389 $(
"#spec .fa:first").removeClass(
"fa-check").addClass(
"fa-times");
390 $(
"#spec").css(
"color",
"red");
394 if ( pwdRequirements[
"letter"] > 0 ) {
396 $(
"#letter .fa").removeClass(
"fa-times").addClass(
"fa-check");
397 $(
"#letter").css(
"color",
"green");
399 $(
"#letter .fa").removeClass(
"fa-check").addClass(
"fa-times");
400 $(
"#letter").css(
"color",
"red");
413 <!-- STYLE CONTENT -->
414 <style type=
"text/css">
422 .container-fluid-margin {
426 .k-block > .k-header {
431 .hcu-info-margin, .hcu-error-margin {
435 .hcu-info-padding, .hcu-error-padding {
444 .hcu-container-margin {
452 .pwd-fail {color:red}
453 .pwd-pass {color: green}
456 <!-- HTML CONTENT -->
457 <div
class=
"container-fluid hcuProfilePwdDiv">
458 <div
class=
"well well-sm">
462 <h3><?php echo $MC->msg(
'Change Password', HCU_DISPLAY_AS_HTML); ?></h3>
465 <!-- FORM ELEMENTS -->
466 <form
id=
"formProfile" name=
"formProfile">
468 <div
class=
"col-xs-12 hcu-container-margin">
469 <label
for=
"profilePasswordCurr" class=
"hcu-full-width">
470 <span><?php echo $MC->msg(
'Re-enter Password', HCU_DISPLAY_AS_HTML); ?>: </span>
471 <span
class=
"fa fa-question-circle-o" id=
"reenterTip"></span>
474 <input type=
"password" name=
"profilePasswordCurr" 475 id=
"profilePasswordCurr" 476 class=
"k-textbox hcu-full-width" 477 placeholder=
"<?php echo $MC->msg('Re-enter Password', HCU_DISPLAY_AS_HTML); ?>" 478 data-required-msg=
"<?php echo $MC->msg('Invalid Authentication', HCU_DISPLAY_AS_HTML) ?>" 481 <?php
if ( strlen( $pwdHelpURL ) > 0 ) { ?>
482 <div
class=
"hcu-full-width">
484 <span><?php echo $MC->combo_msg(
'Password Hints Doc', HCU_DISPLAY_AS_HTML,
"#link#",
"javascript:show_help();"); ?></span>
492 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
493 <label
for=
"profilePasswordNew1" class=
"hcu-full-width">
494 <span><?php echo $MC->msg(
'New Password', HCU_DISPLAY_AS_HTML); ?>:</span>
495 <span
class=
"fa fa-question-circle-o" id=
"newTip1"></span>
498 <input type=
"text" name=
"showPasswordText" id=
"showPasswordText" class=
"k-textbox hcu-full-width" style=
"display:none;">
500 <input type=
"password" name=
"profilePasswordNew1" 501 id=
"profilePasswordNew1" 502 class=
"k-textbox hcu-full-width must_equal" 503 placeholder=
"<?php echo $MC->msg('New Password', HCU_DISPLAY_AS_HTML); ?>" 507 data-required-msg=
"<?php echo $MC->msg('New password requirements', HCU_DISPLAY_AS_HTML) ?>" 508 data-homecuCustomMinLen-msg=
"<?php echo $MC->msg( "New password requirements
", HCU_DISPLAY_AS_HTML) ?>" 509 data-homecuCustomMaxLen-msg=
"<?php echo $MC->msg( "New password requirements
", HCU_DISPLAY_AS_HTML) ?>" 513 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
514 <label
class=
"hcu-full-width hidden-xs"> </label>
516 <button type=
'button' id=
'showPassword' class=
'k-button'>
517 <span><?php echo $MC->msg(
"Show", HCU_DISPLAY_AS_HTML ); ?></span>
523 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
524 <label
for=
"profilePasswordNew2">
525 <span><?php echo $MC->msg(
'Confirm New Password', HCU_DISPLAY_AS_HTML); ?>: </span>
526 <span
class=
"fa fa-question-circle-o" id=
"newTip2"></span>
529 <input type=
"password" name=
"profilePasswordNew2" 530 id=
"profilePasswordNew2" 531 class=
"k-textbox hcu-full-width" 532 placeholder=
"<?php echo $MC->msg('Confirm New Password', HCU_DISPLAY_AS_HTML); ?>" 536 homecu-equals=
"must_equal" 537 data-required-msg=
"<?php echo $MC->msg('New passwords do not match', HCU_DISPLAY_AS_HTML) ?>" 538 data-homecuCustomEquals-msg=
"<?php echo $MC->msg('New passwords do not match', HCU_DISPLAY_AS_HTML) ?>" 542 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
543 <label
for=
"passRequirements">
544 <span><?php echo $MC->msg(
"Password Requirements", HCU_DISPLAY_AS_HTML); ?>:</span>
547 <div
class=
"k-block k-shadow">
549 for($i = 0; $i < count($pwdRequirements); $i++) {
551 <span id='{$pwdRequirements[$i]["which
"]}' style='color: red;'> 552 <span class='fa fa-times'></span> 553 <span>{$pwdRequirements[$i]["text
"]}</span> 563 <div
class=
"hcu-template">
564 <div
class=
"hcu-edit-buttons k-state-default">
566 <a href=
"##" id=
"btnUpdate" class=
"k-button k-primary">
567 <i
class=
"fa fa-check fa-lg"></i><?php echo $MC->msg(
"Update", HCU_DISPLAY_AS_HTML); ?>
578 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');