private function onCrossLoginB(GWF_User $user) { if ($user->isDeleted()) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false === GWF_Session::onLogin($user, false, true)) { return $this->module->error('ERR_GENERAL', array(__FILE__, __LINE__)); } return $this->module->message('msg_cross_login'); }
public function onLoginAs() { $form = $this->getForm(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateLoginAs(); } if (false === ($user = GWF_User::getByName($form->getVar('username')))) { return GWF_HTML::lang('ERR_UNKNOWN_USER'); } GWF_Session::onLogin($user); return $this->module->message('msg_login_as', array($user->displayUsername())); }
private static function onActivated(Module_Register $module, GWF_User $user) { if (false === GWF_Hook::call(GWF_Hook::ACTIVATE, $user, array(true))) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if ($module->wantAutoLogin()) { if (false === GWF_Session::onLogin($user)) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } GWF_Website::redirect(GWF_WEB_ROOT . 'welcome'); } else { return $module->message('msg_activated'); } }
private function onLoggedIn(GWF_User $user, $isAjax) { $last_url = GWF_Session::getLastURL(); if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php'; GWF_LoginHistory::insertEvent($user->getID()); # save last login time $user->saveVar('user_lastlogin', time()); if ($this->module->cfgCleanupAlways()) { GWF_LoginFailure::cleanupUser($user->getID()); } if ($isAjax) { return sprintf('1:%s', GWF_Session::getSessID()); } else { GWF_Session::set('GWF_LOGIN_BACK', $last_url); if (false !== ($lang = $user->getLanguage())) { GWF_Language::setCurrentLanguage($lang); } if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) { GWF_Session::set('GWF_LOGIN_FAILS', $fails); } GWF_Website::redirect(GWF_WEB_ROOT . 'welcome'); } }