public static function main() { if (!wbUser::isLoggedIn()) { $redirecturl = wbModule::url('bds', 'bds', 'main'); wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('redirecturl' => urlencode($redirecturl)))); } $loadjsmod = wbRequest::getVarClean('loadjsmod', 'str', ''); wbPage::setPage('jspage'); $userInfo = wbUser::getSession(); $role = ''; if (isset($userInfo['roles'][0]['role_name'])) { $role = strtolower($userInfo['roles'][0]['role_name']); } $script = <<<HEREDOC Webi.ROUTE_URL = "ws.php?type=json&module=bds"; var _UNAME = "{$userInfo['user_name']}"; var _RNAME = "{$userInfo['user_realname']}"; var _GNAME = "{$role}"; HEREDOC; wbPage::addScriptCode($script); wbPage::addScript('modules/bds/views/script/properties.js'); wbPage::addScript('modules/bds/views/script/GridPanel.js'); wbPage::addScript('modules/bds/views/script/FormPanel.js'); wbPage::addScript('modules/bds/views/script/ModulePanel.js'); wbPage::addScript('modules/base/views/script/roles-jsloader.php'); wbPage::addScript('modules/bds/views/script/jsloader.php'); return array('loadjsmod' => $loadjsmod); }
public static function send_email() { $email = wbRequest::getVarClean('email', 'str', ''); $npwpd = wbRequest::getVarClean('npwpd', 'str', ''); $user_name = wbRequest::getVarClean('user_name', 'str', ''); $question = wbRequest::getVarClean('question', 'str', ''); $answer = wbRequest::getVarClean('answer', 'str', ''); $msg = ''; if (empty($npwpd) or empty($email) or empty($user_name) or empty($answer)) { $msg .= 'Semua isian harus diisi. '; } if (!empty($msg)) { wbResponse::Redirect(wbModule::url('bds', 'helper', 'lupa_password', array('email' => $email, 'npwpd' => $npwpd, 'user_name' => $user_name, 'question' => $question, 'answer' => $answer, 'errorMsg' => $msg))); } /*cek jabawan*/ try { $ws_client = self::getNusoap(); $data2 = array(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'helper', 'method' => 'cek_jawaban', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); $ws_data = self::getResultData($ws_client, $params); $data2['items'] = $ws_data['data']; $data2['total'] = $ws_data['total']; $data2['message'] = $ws_data['message']; $data2['success'] = $ws_data['success']; } catch (Exception $e) { $data2['message'] = $e->getMessage(); } $items = $data2['items']; if ($data2['total'] > 0 and $data2['success']) { /* Ganti Password*/ try { $ws_client = self::getNusoap(); $data3 = array(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'helper', 'method' => 'ganti_password', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); $ws_data = self::getResultData($ws_client, $params); $data3['items'] = $ws_data['data']; $data3['total'] = $ws_data['total']; $data3['message'] = $ws_data['message']; $data3['success'] = $ws_data['success']; } catch (Exception $e) { $data3['message'] = $e->getMessage(); } /* Kirim Email */ $new_password = $data3['message']; $respons = file_get_contents('http://202.154.24.3:81/mpd/send_email_forgot_password.php?receiver=' . $email . '&username='******'&password='******'bds', 'helper', 'lupa_password', array('errorMsg' => 'Password Berhasil Diubah. Silahkan cek email Anda untuk mengetahui password terbaru Anda.'))); } else { wbResponse::Redirect(wbModule::url('bds', 'helper', 'lupa_password', array('email' => $email, 'npwpd' => $npwpd, 'user_name' => $user_name, 'question' => $question, 'answer' => $answer, 'hasil_query' => $items, 'errorMsg' => 'Data yang cocok tidak ditemukan.' . $data2['message']))); } }
public static function login() { $redirecturl = wbRequest::getVarClean('redirecturl'); $username = wbRequest::getVarClean('username'); $password = wbRequest::getVarClean('password'); try { $uid = wbUser::logIn($username, $password); if (!empty($redirecturl)) { wbResponse::Redirect($redirecturl); } else { wbResponse::Redirect('index.php'); } } catch (UserLoginFailedException $e) { wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('username' => $username, 'redirecturl' => urlencode($redirecturl), 'msg' => $e->getMessage()))); } }
/** * call module controller */ public static function call($module, $class, $method, $params = array(), $type = '') { $className = self::loadController($module, $class, $type); if (!method_exists($className, $method)) { throw new ClassMethodNotExistException('Method ' . $method . ' does not exist in Class ' . $className); } $vars = get_class_vars($className); if (isset($vars['loggedInFirst']) && $vars['loggedInFirst'] === true) { if (!wbUser::isLoggedIn()) { $redirecturl = wbModule::url($module, $module, 'main'); $url = wbModule::url('base', 'base', 'loginform', array('redirecturl' => $redirecturl)); throw new Exception('Session login anda telah expire atau belum login. Silahkan <a href="' . $url . '" title="Login">Login</a> kembali.<br/><br/><b>Security Info</b><br/>Hal ini dilakukan untuk menjaga keamanan aplikasi, jika anda telah idle dalam jangka waktu yg cukup lama maka anda diharuskan untuk melakukan autentifikasi kembali'); } } return call_user_func($className . '::' . $method, $params); }
public static function loginCard() { $redirecturl = wbRequest::getVarClean('redirecturl'); $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'base', 'class' => 'roles.dologin', 'method' => 'loginCard', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); try { $ws_data = self::getResultData($ws_client, $params); if ($ws_data['success']) { $userInfo = $ws_data['data']; wbUser::setSession($userInfo['user_id'], $userInfo['user_name'], $userInfo['user_email'], $userInfo['user_realname'], $userInfo['roles']); if (!empty($redirecturl)) { wbResponse::Redirect($redirecturl); } else { wbResponse::Redirect('index.php'); } } else { throw new Exception("Username atau Password Salah"); } } catch (UserLoginFailedException $e) { wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('username' => $username, 'redirecturl' => urlencode($redirecturl), 'msg' => $e->getMessage()))); } }
<?php if (wbUser::isLoggedIn()) { $userInfo = wbUser::getSession(); ?> Anda telah login sebagai <?php echo $userInfo['user_name']; ?> . <br/> [<a href="<?php echo wbModule::url('base', 'base', 'logout'); ?> " title="LogOut">LogOut</a>] <?php return; } ?> <form action="<?php echo $loginurl; ?> " method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="redirecturl" id="redirecturl" value="<?php echo $redirecturl; ?> " /> <div class="loginform"> <div class="loginform-title"></div> <div class="loginform-content">