当前位置: 首页>>代码示例>>PHP>>正文


PHP Context::logout方法代码示例

本文整理汇总了PHP中thebuggenie\core\framework\Context::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::logout方法的具体用法?PHP Context::logout怎么用?PHP Context::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thebuggenie\core\framework\Context的用法示例。


在下文中一共展示了Context::logout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runLogout

 /**
  * Logs the user out
  *
  * @param \thebuggenie\core\framework\Request $request
  *
  * @return bool
  */
 public function runLogout(framework\Request $request)
 {
     if ($this->getUser() instanceof entities\User) {
         framework\Logging::log('Setting user logout state');
         $this->getUser()->setOffline();
     }
     framework\Context::logout();
     if ($request->isAjaxCall()) {
         return $this->renderJSON(array('status' => 'logout ok', 'url' => framework\Context::getRouting()->generate(framework\Settings::getLogoutReturnRoute())));
     }
     $this->forward(framework\Context::getRouting()->generate(framework\Settings::getLogoutReturnRoute()));
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:19,代码来源:Common.php

示例2: loginCheck

 /**
  * Returns the logged in user, or default user if not logged in
  *
  * @param \thebuggenie\core\framework\Request $request
  * @param \thebuggenie\core\framework\Action  $action
  *
  * @return \thebuggenie\core\entities\User
  */
 public static function loginCheck(framework\Request $request, framework\Action $action)
 {
     try {
         $authentication_method = $action->getAuthenticationMethodForAction(framework\Context::getRouting()->getCurrentRouteAction());
         $user = null;
         $external = false;
         switch ($authentication_method) {
             case framework\Action::AUTHENTICATION_METHOD_ELEVATED:
             case framework\Action::AUTHENTICATION_METHOD_CORE:
                 $username = $request['tbg3_username'];
                 $password = $request['tbg3_password'];
                 if ($authentication_method == framework\Action::AUTHENTICATION_METHOD_ELEVATED) {
                     $elevated_password = $request['tbg3_elevated_password'];
                 }
                 $raw = true;
                 // If no username and password specified, check if we have a session that exists already
                 if ($username === null && $password === null) {
                     if (framework\Context::getRequest()->hasCookie('tbg3_username') && framework\Context::getRequest()->hasCookie('tbg3_password')) {
                         $username = framework\Context::getRequest()->getCookie('tbg3_username');
                         $password = framework\Context::getRequest()->getCookie('tbg3_password');
                         $user = self::getB2DBTable()->getByUsername($username);
                         if ($authentication_method == framework\Action::AUTHENTICATION_METHOD_ELEVATED) {
                             $elevated_password = framework\Context::getRequest()->getCookie('tbg3_elevated_password');
                             if ($user instanceof User && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             } else {
                                 if ($user instanceof User && !$user->hasPasswordHash($elevated_password)) {
                                     framework\Context::setUser($user);
                                     framework\Context::getRouting()->setCurrentRouteName('elevated_login_page');
                                     throw new framework\exceptions\ElevatedLoginException('reenter');
                                 }
                             }
                         } else {
                             if ($user instanceof User && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             }
                         }
                         if (!$user instanceof User) {
                             framework\Context::logout();
                             throw new \Exception('No such login');
                         }
                     }
                 }
                 // If we have authentication details, validate them
                 if (framework\Settings::isUsingExternalAuthenticationBackend() && $username !== null && $password !== null) {
                     $external = true;
                     framework\Logging::log('Authenticating with backend: ' . framework\Settings::getAuthenticationBackend(), 'auth', framework\Logging::LEVEL_INFO);
                     try {
                         $mod = framework\Context::getModule(framework\Settings::getAuthenticationBackend());
                         if ($mod->getType() !== Module::MODULE_AUTH) {
                             framework\Logging::log('Auth module is not the right type', 'auth', framework\Logging::LEVEL_FATAL);
                         }
                         if (framework\Context::getRequest()->hasCookie('tbg3_username') && framework\Context::getRequest()->hasCookie('tbg3_password')) {
                             $user = $mod->verifyLogin($username, $password);
                         } else {
                             $user = $mod->doLogin($username, $password);
                         }
                         if (!$user instanceof User) {
                             // Invalid
                             framework\Context::logout();
                             throw new \Exception('No such login');
                             //framework\Context::getResponse()->headerRedirect(framework\Context::getRouting()->generate('login'));
                         }
                     } catch (\Exception $e) {
                         throw $e;
                     }
                 } elseif (framework\Settings::isUsingExternalAuthenticationBackend()) {
                     $external = true;
                     framework\Logging::log('Authenticating without credentials with backend: ' . framework\Settings::getAuthenticationBackend(), 'auth', framework\Logging::LEVEL_INFO);
                     try {
                         $mod = framework\Context::getModule(framework\Settings::getAuthenticationBackend());
                         if ($mod->getType() !== Module::MODULE_AUTH) {
                             framework\Logging::log('Auth module is not the right type', 'auth', framework\Logging::LEVEL_FATAL);
                         }
                         $user = $mod->doAutoLogin();
                         if ($user == false) {
                             // Invalid
                             framework\Context::logout();
                             throw new \Exception('No such login');
                             //framework\Context::getResponse()->headerRedirect(framework\Context::getRouting()->generate('login'));
                         } else {
                             if ($user == true) {
                                 $user = null;
                             }
                         }
                     } catch (\Exception $e) {
                         throw $e;
                     }
                 } elseif ($username !== null && $password !== null && !$user instanceof User) {
                     $external = false;
                     framework\Logging::log('Using internal authentication', 'auth', framework\Logging::LEVEL_INFO);
                     $user = self::getB2DBTable()->getByUsername($username);
//.........这里部分代码省略.........
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:101,代码来源:User.php

示例3: __

<?php

$tbg_response->setTitle(__('Configure authentication'));
?>
<center>
<h1><?php 
echo __('Settings saved');
?>
</h1>
<?php 
echo __('To apply changes to the authentication system, you have been automatically logged out. The new authentication system is now in use.');
?>
<p><?php 
echo link_tag(make_url('home'), __('Continue'));
?>
</p>
</center>

<?php 
\thebuggenie\core\framework\Context::logout();
开发者ID:founderio,项目名称:thebuggenie,代码行数:20,代码来源:saveauthentication.html.php


注:本文中的thebuggenie\core\framework\Context::logout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。