2 $monLibrary= dirname(__FILE__) .
"/../library";
3 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
4 require_once(
"$monLibrary/cu_top.i");
5 require_once(
"$monLibrary/ck_hticket.i");
6 require_once(
"$monLibrary/cu_pass.i");
7 require_once(
"$sharedLibrary/errormail.i");
9 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
12 header(
"Location: /hcuadm/hcu_noperm.prg");
16 $dms_ok=array(
'action'=>
'string',
'new1'=>
'string',
'new2'=>
'string',
'rowid'=>
'string');
20 $self = $_SERVER[
'PHP_SELF'];
24 if ($new1 != $new2) {$msg .=
"New Passwords Don't Match.<br>"; }
25 if (preg_match(
"/['\"]/",$new1)){$msg .=
"Invalid Characters in New Password.<br>";}
26 if (strlen($new1) < 4) {$msg .=
"Password must be at least 4 characters.<br>";}
27 if (strlen($new1) > 0 && !(preg_match(
"/\d/",$new1) && preg_match(
"/\D/",$new1))) {
28 $msg .=
"Password must contain both number and letter characters!\n";}
33 $salt = compute_salt(0);
34 $hash = password_hash($new1, PASSWORD_DEFAULT);
35 $sql=
"update cuadminusers set passwd='$hash', forcechange='N', 36 pwchange=now(), failedremain=5 37 where user_name='$rowid'";
38 $sth = db_query($sql,$dbh);
40 $msg=
"Unable to update password";
42 $notify->mailto=
'miki@homecu.net';
43 $notify->replyto=
'miki@homecu.net';
44 $notify->subject=
'hcuadm/MonPass encountered Error updating password';
45 $notify->msgbody =
"\tMonPass Unable to update Master Password\n\n";
46 $notify->msgbody .=
"Cu: $rowid\n";
47 $notify->msgbody .= $sql;
48 $notify->file = __FILE__;
55 cu_header(
"Password Updated");
56 cu_message(
"Succeeded<br>Password successfully updated");
63 cu_header(
"Password Change");
68 var strNew1 = document.forms[0].new1.value;
69 var strNew2 = document.forms[0].new2.value;
74 if (strNew1.length < 4 || strNew1.length > 8)
75 { strMessage +=
'New password must be from 4 to 8 characters long.\\n';}
76 if (strNew1 != strNew2)
77 { strMessage +=
"New passwords do not match.\\n";}
78 if (strNew1.indexOf(
"'") != -1 || strNew1.indexOf(
'"') != -1)
79 { strMessage +=
"Invalid Characters in New password.\\n";}
80 var boolHasDigit =
false;
81 var boolHasChar =
false;
82 for (i=0; i < strNew1.length; i++)
84 ch = strNew1.charAt(i);
85 if (ch >=
'0' && ch <=
'9')
86 { boolHasDigit =
true; }
87 if ((ch >=
'A' && ch <=
'Z') || (ch >=
'a' && ch <=
'z'))
88 { boolHasChar =
true; }
90 if ((boolHasDigit ==
false) || (boolHasChar ==
false))
91 { strMessage +=
"Password must contain both number and letter characters.\\n";}
93 if (strMessage.length > 0)
100 document.forms[0].submit();
109 <FORM NAME=login ACTION=
"${self}" METHOD=post>
110 <TABLE BORDER=0 width=
"90%" cellpadding=3 cellspacing=0
class=
'dmsbg'><tr><td>
111 <TABLE BORDER=0 width=
"100%" cellpadding=2 cellspacing=0 bgcolor=white>
112 <TR><TD CLASS=
"bar" align=
"center" colspan=3>Password Change</TD></TR>
114 <TD CLASS=
"hdr" align=
"right">Master Password:</TD>
115 <TD CLASS=
"dtl"><INPUT NAME=
"new1" TYPE=
"password" SIZE=
"10" MAXLENGTH=
"8" 117 <TD CLASS=
"dtl">Password must be from 4 to 8 characters
long and contain a
118 combination of numbers and letters</TD>
121 <TD CLASS=
"hdr" align=
"right">Confirm Master Password:</TD>
122 <TD CLASS=
"dtl"><INPUT NAME=
"new2" TYPE=
"password" SIZE=
"10" MAXLENGTH=
"8" 124 <TD CLASS=
"dtl">Enter
new password again to confirm</TD>
127 <td
class=
'dtl'> </td>
128 <TD CLASS=
"dtl" colspan=2>
129 <input type=hidden name=
"action" value=
"Change Password">
130 <input type=hidden name=
"rowid" value=
"$rowid">
131 <INPUT TYPE=
"button" NAME=
"BtnSubmit" VALUE=
" Change Password " onClick=
"validate()"></TD></TR>