185 lines
11 KiB
PHP
185 lines
11 KiB
PHP
<?php
|
|
class USER_PASS extends USER
|
|
{
|
|
public function user_pass_javainit()
|
|
{
|
|
|
|
}
|
|
|
|
public function fn_pass_init()
|
|
{
|
|
if(isset($_REQUEST['task'])){$task=trim(strtolower($_REQUEST['task']));}
|
|
if(isset($_POST['task'])){$task=trim(strtolower($_POST['task']));}
|
|
switch($task)
|
|
{
|
|
case "updatepassword":
|
|
$this->fn_updatepassword();
|
|
break;
|
|
|
|
default:
|
|
$this->fn_default_pass();
|
|
break;
|
|
}
|
|
}
|
|
|
|
public function fn_default_pass()
|
|
{
|
|
echo $this->FN_CREATEHEADER();
|
|
echo "<style>
|
|
.besidepassword {margin-left:6px;margin-top:-5px;position:absolute;z-index:0}
|
|
</style>";
|
|
echo "<script>
|
|
var myForm;var myFormsearch;var dguser;
|
|
function initObject()
|
|
{
|
|
var formData = [
|
|
{type: \"settings\", position: \"label-left\", labelWidth: 160, inputWidth: 120},
|
|
{type: \"block\", width:430, list:[
|
|
{type: \"label\", label:\"<u>Perubahan Password</u>\"},
|
|
{type: \"password\", name:\"txtpassold\",label: \"Password Old\", inputWidth: 110,info:true, readonly:false,className:\"txtcenter\",maxLength:8,value:\"".$_SESSION['pass']."\"},
|
|
{type: \"checkbox\", name:\"chkshowpassold\",label: \"\",className:\"besidepassword\"},
|
|
{type: \"password\", name:\"txtpassnew\",label: \"New Password\", inputWidth: 110,info:true, tooltip:\"Masukkan Password Anda yang baru\",validate:\"NotEmpty\",className:\"txtcenter\",maxLength:10,value:\"\"},
|
|
{type: \"checkbox\", name:\"chkshowpassnew\",label: \"\",className:\"besidepassword\"},
|
|
{type: \"password\", name:\"txtpassreenter\",label: \"Reenter New Password\", inputWidth: 110,info:true, tooltip:\"Masukkan Kembali password anda yang baru\",validate:\"NotEmpty\",className:\"txtcenter\",maxLength:10,value:\"\"},
|
|
{type: \"checkbox\", name:\"chkshowpassreenter\",label: \"\",className:\"besidepassword\"},
|
|
|
|
{type: \"checkbox\", label: \"Ya, Yakin ingin disimpan?\", position:\"label-right\",offsetLeft:20, offsetTop: 10, checked: 1, labelWidth:330, list:[
|
|
{type: \"button\", name:\"btnsave\",value: \"Save\", offsetLeft: 50, offsetTop: 10, inputWidth: 50,className:\"button_update\"},
|
|
{type: \"newcolumn\"},
|
|
{type: \"button\", name:\"btncancel\",value: \"Cancel\", offsetLeft: 8, offsetTop: 10,className:\"button_cancel\"}
|
|
]}
|
|
]}
|
|
];
|
|
myForm = new dhtmlXForm(\"divformpass\", formData);
|
|
myForm.enableLiveValidation(true);
|
|
myForm.setFocusOnFirstActive(true);
|
|
|
|
// === Event MyForm
|
|
myForm.attachEvent(\"onButtonClick\",function(id){
|
|
switch(id)
|
|
{
|
|
case 'btnsave':
|
|
if(myForm.validate())
|
|
{";
|
|
$params="'obj=".$this->enc("user_pass")."&task=updatepassword'";
|
|
echo "url=fn_dhtmlxsenddata('".$this->enc("obj_user")."',$params);
|
|
myForm.send(url,\"get\",function(loader, response){
|
|
var sp=trim(response).split('|');
|
|
//alert(response);
|
|
if(sp[0]=='ok')
|
|
{
|
|
fn_dhtmlxmessage('','Password sudah berhasil diupdate. TERIMA KASIH');
|
|
myform_clear();
|
|
fn_grid_loaddata();
|
|
}
|
|
else if(sp[0]=='failed')
|
|
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
|
|
else
|
|
{fn_dhtmlxmessage('error','Error Found : '+response);}
|
|
|
|
});
|
|
}
|
|
break;
|
|
case 'btncancel':
|
|
myform_clear();
|
|
break;
|
|
}
|
|
});
|
|
|
|
myPop = new dhtmlXPopup({mode:\"right\"});
|
|
myForm.attachEvent(\"onChange\",function(id,value,state){
|
|
if(id=='chkshowpassold')
|
|
{
|
|
|
|
var passwordtext=myForm.getItemValue(\"txtpassold\");
|
|
|
|
var x = getAbsoluteLeft(myForm.getInput(\"txtpassold\"));
|
|
var y = getAbsoluteTop(myForm.getInput(\"txtpassold\"));
|
|
var w = myForm.getInput(\"txtpassold\").offsetWidth;
|
|
var h = myForm.getInput(\"txtpassold\").offsetHeight;
|
|
myPop.attachHTML(\"Your Password :\"+passwordtext);
|
|
if(state){myPop.show(x,y,w,h);}
|
|
else{myPop.hide();}
|
|
}
|
|
if(id=='chkshowpassnew')
|
|
{
|
|
|
|
var passwordtext=myForm.getItemValue(\"txtpassnew\");
|
|
|
|
var x = getAbsoluteLeft(myForm.getInput(\"txtpassnew\"));
|
|
var y = getAbsoluteTop(myForm.getInput(\"txtpassnew\"));
|
|
var w = myForm.getInput(\"txtpassnew\").offsetWidth;
|
|
var h = myForm.getInput(\"txtpassold\").offsetHeight;
|
|
myPop.attachHTML(\"Your Password :\"+passwordtext);
|
|
if(state){myPop.show(x,y,w,h);}
|
|
else{myPop.hide();}
|
|
}
|
|
if(id=='chkshowpassreenter')
|
|
{
|
|
|
|
var passwordtext=myForm.getItemValue(\"txtpassreenter\");
|
|
|
|
var x = getAbsoluteLeft(myForm.getInput(\"txtpassreenter\"));
|
|
var y = getAbsoluteTop(myForm.getInput(\"txtpassreenter\"));
|
|
var w = myForm.getInput(\"txtpassreenter\").offsetWidth;
|
|
var h = myForm.getInput(\"txtpassold\").offsetHeight;
|
|
myPop.attachHTML(\"Your Password :\"+passwordtext);
|
|
if(state){myPop.show(x,y,w,h);}
|
|
else{myPop.hide();}
|
|
}
|
|
});
|
|
//myForm.attachEvent(\"onValidateError\",function(id,value,result){
|
|
//fn_dhtmlxmessage('error','Error Found : Harap Isikan Kolom - kolom yang berlabel merah.TERIMA KASIH');
|
|
//myForm.setItemFocus(id);
|
|
//result=false;
|
|
//});
|
|
}
|
|
|
|
function myform_clear()
|
|
{
|
|
myForm.setItemValue(\"txtpassold\",myForm.getItemValue(\"txtpassnew\"));
|
|
myForm.setItemValue(\"txtpassnew\",'');
|
|
myForm.setItemValue(\"txtpassreenter\",'');
|
|
myForm.setItemFocus(\"txtpassnew\");
|
|
}
|
|
|
|
|
|
</script>";
|
|
echo $this->FN_CLOSEHEADER();
|
|
echo $this->FN_CREATEBODY("e8f1ff");
|
|
echo " <table width=\"98%\" border=\"0\">
|
|
<tr>
|
|
<td width=\"40%\" valign=\"top\">
|
|
<div id=\"divformpass\"></div>
|
|
</td>
|
|
</tr>
|
|
</table>";
|
|
echo $this->FN_CREATEFOOTER();
|
|
}
|
|
|
|
public function fn_updatepassword()
|
|
{
|
|
$oldpass=$_REQUEST['txtpassold'];
|
|
$passnew=$_REQUEST['txtpassnew'];
|
|
// echo "failed|$oldpass";return false;
|
|
//return false;
|
|
$qry="update ".DB_APORTIL.".tbl_employee_accessibility
|
|
set pass='".$this->enc($passnew)."',maskpass='1234',uby='".$_SESSION['nik']."',udt=now()
|
|
where nik='".$_SESSION['nik']."'";
|
|
if(!$this->fn_row_isexists("select nik from ".DB_APORTIL.".tbl_employee_accessibility where nik='".$_SESSION['nik']."' and pass='".$this->enc($oldpass)."' and isdeleted=0"))
|
|
{
|
|
echo "failed|Password Lama anda tidak Match.TERIMA KASIH";return false;
|
|
}
|
|
|
|
if($this->executequery($qry))
|
|
{
|
|
echo 'ok';
|
|
//$msg="Menu baru <b>".strtoupper("$nmuser")."</b> sudah berhasil ditambahkan<br/>";
|
|
//$msg.="Klik ".$this->CREATE_LINK($this->fn_url_home(),"disini","javascript:void(0)","_self","Penambahan Menu Baru");
|
|
//$msg.=" untuk Penambahan Menu Baru. TERIMA KASIH";
|
|
//echo $this->SHOWMESSAGE($msg);
|
|
}else{echo "failed|".$this->getErrorQuery();}
|
|
}
|
|
}
|
|
?>
|