function form_passwd_post($raw,$data) { global $DBH; checkAccess(); if ($data['f1']!=$data['f2']) return LocalError(WGSL("perr","Password error")); if ($data['uid']==0) FatalError(WGSL("euid","Unknown UID")); $db=dbfirst($DBH,'ewguser','id',$data['uid']); if ($db===false) FatalError(WGSL("euid","Unknown UID")); $x=WGPasswd($db['name'],false,$data['f1']); if ($x) WGToast(WGSL("pokc","Password changed")); else LocalError(WGSL("p2err","Password not changed")); $data['f1']=''; $data['f2']=''; WGSetActivity('main'); return $data; }
function form_access_post($dta) { global $OUTJSON; global $CMD; global $WEBGUI; global $APPL; $usr = WGSessionUser(); if ($usr===false) FatalError("Access denied"); if ($dta['f2']!=$dta['f3']) { WGSetActivity("error"); return; } $x = WGPasswd($usr['name'],$dta['f1'],$dta['f2']); if ($x==false) { WGSetActivity("error"); return; } WGSetActivity("accessok"); }