/** * Can only be fetched once. The XMPP Session is not valid anymore on refresh. User will have to relogin manually. * @return array */ public static function getPrebindInfo() { require GO::config()->root_path . 'modules/chat/xmpp-prebind-php/lib/XmppPrebind.php'; GO::debug("CHAT: Pre binding to XMPP HOST: " . self::getXmppHost() . " BOSH URI: " . self::getBoshUri() . " with user " . GO::user()->username); if (isset(GO::session()->values['chat']['p'])) { try { $xmppPrebind = new \XmppPrebind(self::getXmppHost(), self::getBoshUri(), GO::config()->product_name, strpos(self::getBoshUri(), 'https') !== false, false); if ($xmppPrebind->connect(GO::user()->username, \GO\Base\Util\Crypt::decrypt(GO::session()->values['chat']['p']))) { $xmppPrebind->auth(); GO::debug("CHAT: connect successfull"); // array containing sid, rid and jid $ret = $xmppPrebind->getSessionInfo(); $ret['prebind'] = "true"; return $ret; } else { GO::debug("CHAT: failed to connect"); } } catch (\Exception $e) { GO::debug("CHAT: Authentication failed: " . $e); } } else { GO::debug("CHAT: Password not set"); } $ret = array('prebind' => 'false', 'jid' => '', 'sid' => '', 'rid' => ''); return $ret; }
public function formatDisplay($key, &$attributes, \GO\Customfields\Model\AbstractCustomFieldsRecord $model) { if (\GO\Customfields\Model\AbstractCustomFieldsRecord::$formatForExport) { return \GO\Base\Util\Crypt::decrypt($attributes[$key]); } $decrypted = !empty($attributes[$key]) ? '<div ext:qtip="' . htmlspecialchars(\GO\Base\Util\Crypt::decrypt($attributes[$key]), ENT_COMPAT, 'utf-8') . '">' . \GO::t('pointForText') . '</div>' : ''; return $decrypted; }
protected function actionIndex($params) { //$funcParams = \GO\Base\Util\Crypt::decrypt($params['f']); if (substr($_REQUEST['f'], 0, 9) == '{GOCRYPT}') { $funcParams = \GO\Base\Util\Crypt::decrypt($_REQUEST['f']); } else { $funcParams = json_decode(base64_decode($_REQUEST['f']), true); } $this->render('external', $funcParams); }
/** * Page with a login form * If $siteconfig['tickets_allow_anonymous'] is set to TRUE then this page * shows also a link to the "New ticket" page. */ protected function actionTicketLogin() { // Create an empty user model $model = new \GO\Base\Model\User(); if (\GO\Base\Util\Http::isPostRequest()) { // Set the posted values to the user model $model->username = $_POST['User']['username']; $password = $_POST['User']['password']; // Check if the login is correct, then the correct user object is returned $user = \GO::session()->login($model->username, $password); if (!$user) { // set the correct login failure message GOS::site()->notifier->setMessage('error', \GO::t('badLogin')); } else { if (!empty($_POST['rememberMe'])) { // Encrypt the username for the rememberMe cookie $encUsername = \GO\Base\Util\Crypt::encrypt($model->username); if ($encUsername) { $encUsername = $model->username; } // Encrypt the password for the rememberMe cookie $encPassword = \GO\Base\Util\Crypt::encrypt($password); if ($encPassword) { $encPassword = $password; } // Set the rememberMe cookies \GO\Base\Util\Http::setCookie('GO_UN', $encUsername); \GO\Base\Util\Http::setCookie('GO_PW', $encPassword); } // Login is successfull, redirect to the ticketlist page $this->redirect(array('tickets/site/ticketlist')); } } // Render the loginselection form $this->render('loginSelection', array('model' => $model)); }
/** * Render a login page */ public function actionLogin() { $model = new \GO\Base\Model\User(); if (\GO\Base\Util\Http::isPostRequest() && isset($_POST['User'])) { $model->username = $_POST['User']['username']; $password = $_POST['User']['password']; $user = \GO::session()->login($model->username, $password); //reset language after login if (!empty(\Site::model()->language)) { \GO::language()->setLanguage(\Site::model()->language); } if (!$user) { \Site::notifier()->setMessage('error', \GO::t('badLogin')); // set the correct login failure message } else { if (!empty($_POST['rememberMe'])) { $encUsername = \GO\Base\Util\Crypt::encrypt($model->username); if ($encUsername) { $encUsername = $model->username; } $encPassword = \GO\Base\Util\Crypt::encrypt($password); if ($encPassword) { $encPassword = $password; } \GO\Base\Util\Http::setCookie('GO_UN', $encUsername); \GO\Base\Util\Http::setCookie('GO_PW', $encPassword); } $this->redirect($this->getReturnUrl()); } } elseif (isset($_GET['ref'])) { // url to go to after login \GO::session()->values['sites']['returnUrl'] = $_GET['ref']; } echo $this->render('login', array('model' => $model)); }
public function decryptSmtpPassword() { if (!empty(\GO::session()->values['emailModule']['smtpPasswords'][$this->id])) { $decrypted = \GO\Base\Util\Crypt::decrypt(\GO::session()->values['emailModule']['smtpPasswords'][$this->id]); } else { //support for z-push without storing passwords if (empty($this->smtp_password) && method_exists('Request', 'GetAuthPassword') && Request::GetAuthUser() == $this->smtp_username) { $decrypted = Request::GetAuthPassword(); } else { $decrypted = \GO\Base\Util\Crypt::decrypt($this->smtp_password); } } return $decrypted ? $decrypted : $this->smtp_password; }
public function decrypt($password) { if ($this->password != crypt($password, $this->password)) { return false; } else { $this->_decrypted = true; $this->content = Crypt::decrypt($this->content, $password); return true; } }
GO::router()->getController()->fireEvent('inlinescripts'); ?> </script> <?php if (file_exists(\GO::view()->getTheme()->getPath() . 'MainLayout.js')) { echo '<script src="' . \GO::view()->getTheme()->getUrl() . 'MainLayout.js" type="text/javascript"></script>'; echo "\n"; } ?> <script type="text/javascript"> <?php //these parameter are passed by dialog.php. These are used to directly link to //a dialog. if (isset($_REQUEST['f'])) { if (substr($_REQUEST['f'], 0, 9) == '{GOCRYPT}') { $fp = \GO\Base\Util\Crypt::decrypt($_REQUEST['f']); } else { $fp = json_decode(base64_decode($_REQUEST['f']), true); } \GO::debug("External function parameters:"); \GO::debug($fp); ?> if(GO.<?php echo $fp['m']; ?> ) { GO.mainLayout.on("render", function(){ GO.<?php echo $fp['m']; ?>
protected function actionLogin($params) { if (!empty($params["login_language"])) { GO::language()->setLanguage($params["login_language"]); } if (!empty($params['domain'])) { $params['username'] .= $params['domain']; } $response = array(); if (!$this->fireEvent('beforelogin', array(&$params, &$response))) { $response['success'] = false; if (!isset($response['feedback'])) { $response['feedback'] = GO::t('badLogin'); } return $response; } $user = \GO::session()->login($params['username'], $params['password']); $response['success'] = $user != false; if (!$response['success']) { $response['feedback'] = \GO::t('badLogin'); } else { if (!empty($params['remind'])) { $encUsername = \GO\Base\Util\Crypt::encrypt($params['username']); if (!$encUsername) { $encUsername = $params['username']; } $encPassword = \GO\Base\Util\Crypt::encrypt($params['password']); if (!$encPassword) { $encPassword = $params['password']; } \GO\Base\Util\Http::setCookie('GO_UN', $encUsername); \GO\Base\Util\Http::setCookie('GO_PW', $encPassword); } $response['groupoffice_version'] = \GO::config()->version; $response['user_id'] = $user->id; $response['security_token'] = \GO::session()->values["security_token"]; $response['sid'] = session_id(); if (!empty($params['return_user_info'])) { $response['modules'] = array(); foreach (\GO::modules()->getAllModules() as $module) { $response['modules'][] = $module->id; } $response['user'] = \GO::user()->getAttributes(); } if (!empty($params["login_language"])) { GO::language()->setLanguage($params["login_language"]); \GO::user()->language = \GO::language()->getLanguage(); \GO::user()->save(); } } // return $response; if (\GO\Base\Util\Http::isAjaxRequest()) { return $response; } else { $this->redirect(); } }