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


PHP TBGSettings::getAuthenticationBackend方法代码示例

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


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

示例1: do_execute

 public function do_execute()
 {
     $this->cliEcho("\n");
     $this->cliEcho("Revert authentication backend\n", 'white', 'bold');
     $this->cliEcho("This command is useful if you've managed to lock yourself.\n");
     $this->cliEcho("out due to an authentication backend change gone bad.\n\n");
     if (TBGSettings::getAuthenticationBackend() == 'tbg' || TBGSettings::getAuthenticationBackend() == null) {
         $this->cliEcho("You are currently using the default authentication backend.\n\n");
     } else {
         $this->cliEcho("Please type 'yes' if you want to revert to the default authentication backend: ");
         $this->cliEcho("\n");
         if ($this->getInput() == 'yes') {
             TBGSettings::saveSetting(TBGSettings::SETTING_AUTH_BACKEND, 'tbg');
             $this->cliEcho("Authentication backend reverted.\n\n");
         } else {
             $this->cliEcho("No changes made.\n\n");
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:19,代码来源:CliMainRevertAuthBackend.class.php

示例2: image_tag

', 'account_tabs');" href="javascript:void(0);"><?php 
        echo image_tag($module->getAccountSettingsLogo(), array('style' => 'float: left;'), false, $module_name) . $module->getAccountSettingsName();
        ?>
</a></li>
						<?php 
    }
    ?>
					<?php 
}
?>
				</ul>
			</div>
			<div id="account_tabs_panes">
				<div id="tab_profile_pane">
					<?php 
if (TBGSettings::getAuthenticationBackend() != 'tbg' && TBGSettings::getAuthenticationBackend() != null) {
    echo tbg_parse_text(TBGSettings::get('changedetails_message'), null, null, array('embedded' => true));
} else {
    ?>
					<form accept-charset="<?php 
    echo TBGContext::getI18n()->getCharset();
    ?>
" action="<?php 
    echo make_url('account_save_information');
    ?>
" onsubmit="updateProfileInformation('<?php 
    echo make_url('account_save_information');
    ?>
'); return false;" method="post" id="profile_information_form">
						<div class="rounded_box borderless lightgrey cut_bottom" style="margin: 5px 0 0 0; width: 690px; border-bottom: 0;">
							<p class="content"><?php 
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:31,代码来源:myaccount.html.php

示例3: isUsingExternalAuthenticationBackend

 public static function isUsingExternalAuthenticationBackend()
 {
     if (TBGSettings::getAuthenticationBackend() !== null && TBGSettings::getAuthenticationBackend() !== 'tbg') {
         return true;
     } else {
         return false;
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:8,代码来源:TBGSettings.class.php

示例4: __

						<td>
							<select name="auth_backend" id="auth_backend">
								<option value="tbg"<?php 
if (TBGSettings::getAuthenticationBackend() == 'tbg' || TBGSettings::getAuthenticationBackend() == null) {
    ?>
 selected="selected"<?php 
}
?>
><?php 
echo __('The Bug Genie authentication (use internal user mechanisms)');
?>
</option>
								<?php 
foreach ($modules as $module) {
    $selected = null;
    if (TBGSettings::getAuthenticationBackend() == $module->getTabKey()) {
        $selected = ' selected="selected"';
    }
    echo '<option value="' . $module->getTabKey() . '"' . $selected . '>' . $module->getLongName() . '</option>';
}
?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="config_explanation" colspan="2"><?php 
echo __('All modules which provide authentication are shown here. Please ensure your chosen backend is configured first, and please read the warnings included with your chosen backend to ensure that you do not lose administrator access.');
?>
</td>
					</tr>
					<tr>
开发者ID:oparoz,项目名称:thebuggenie,代码行数:31,代码来源:configureauthentication.html.php

示例5: loginCheck

 /**
  * Returns the logged in user, or default user if not logged in
  *
  * @param TBGRequest $request
  * @param TBGAction  $action
  *
  * @return TBGUser
  */
 public static function loginCheck(TBGRequest $request, TBGAction $action)
 {
     try {
         $authentication_method = $action->getAuthenticationMethodForAction(TBGContext::getRouting()->getCurrentRouteAction());
         $user = null;
         $external = false;
         switch ($authentication_method) {
             case TBGAction::AUTHENTICATION_METHOD_ELEVATED:
             case TBGAction::AUTHENTICATION_METHOD_CORE:
                 $username = $request['tbg3_username'];
                 $password = $request['tbg3_password'];
                 if ($authentication_method == TBGAction::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 (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                         $username = TBGContext::getRequest()->getCookie('tbg3_username');
                         $password = TBGContext::getRequest()->getCookie('tbg3_password');
                         $user = TBGUsersTable::getTable()->getByUsername($username);
                         if ($authentication_method == TBGAction::AUTHENTICATION_METHOD_ELEVATED) {
                             $elevated_password = TBGContext::getRequest()->getCookie('tbg3_elevated_password');
                             if ($user instanceof TBGUser && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             } else {
                                 if ($user instanceof TBGUser && !$user->hasPasswordHash($elevated_password)) {
                                     TBGContext::setUser($user);
                                     TBGContext::getRouting()->setCurrentRouteName('elevated_login_page');
                                     throw new TBGElevatedLoginException('reenter');
                                 }
                             }
                         } else {
                             if ($user instanceof TBGUser && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             }
                         }
                         $raw = false;
                         if (!$user instanceof TBGUser) {
                             TBGContext::logout();
                             throw new Exception('No such login');
                         }
                     }
                 }
                 // If we have authentication details, validate them
                 if (TBGSettings::isUsingExternalAuthenticationBackend() && $username !== null && $password !== null) {
                     $external = true;
                     TBGLogging::log('Authenticating with backend: ' . TBGSettings::getAuthenticationBackend(), 'auth', TBGLogging::LEVEL_INFO);
                     try {
                         $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
                         if ($mod->getType() !== TBGModule::MODULE_AUTH) {
                             TBGLogging::log('Auth module is not the right type', 'auth', TBGLogging::LEVEL_FATAL);
                         }
                         if (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                             $user = $mod->verifyLogin($username, $password);
                         } else {
                             $user = $mod->doLogin($username, $password);
                         }
                         if (!$user instanceof TBGUser) {
                             // Invalid
                             TBGContext::logout();
                             throw new Exception('No such login');
                             //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                         }
                     } catch (Exception $e) {
                         throw $e;
                     }
                 } elseif (TBGSettings::isUsingExternalAuthenticationBackend()) {
                     $external = true;
                     TBGLogging::log('Authenticating without credentials with backend: ' . TBGSettings::getAuthenticationBackend(), 'auth', TBGLogging::LEVEL_INFO);
                     try {
                         $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
                         if ($mod->getType() !== TBGModule::MODULE_AUTH) {
                             TBGLogging::log('Auth module is not the right type', 'auth', TBGLogging::LEVEL_FATAL);
                         }
                         $user = $mod->doAutoLogin();
                         if ($user == false) {
                             // Invalid
                             TBGContext::logout();
                             throw new Exception('No such login');
                             //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                         }
                     } catch (Exception $e) {
                         throw $e;
                     }
                 } elseif ($username !== null && $password !== null && !$user instanceof TBGUser) {
                     $external = false;
                     TBGLogging::log('Using internal authentication', 'auth', TBGLogging::LEVEL_INFO);
                     $user = TBGUsersTable::getTable()->getByUsername($username);
                     if (!$user->hasPassword($password)) {
                         $user = null;
                     }
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:TBGUser.class.php

示例6: loginCheck

 /**
  * Returns the logged in user, or default user if not logged in
  *
  * @param string $uname
  * @param string $upwd
  * 
  * @return TBGUser
  */
 public static function loginCheck($username = null, $password = null)
 {
     try {
         $row = null;
         // If no username and password specified, check if we have a session that exists already
         if ($username === null && $password === null) {
             if (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                 $username = TBGContext::getRequest()->getCookie('tbg3_username');
                 $password = TBGContext::getRequest()->getCookie('tbg3_password');
                 $row = TBGUsersTable::getTable()->getByUsernameAndPassword($username, $password);
                 if (!$row) {
                     TBGContext::getResponse()->deleteCookie('tbg3_username');
                     TBGContext::getResponse()->deleteCookie('tbg3_password');
                     throw new Exception('No such login');
                     //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                 }
             }
         }
         // If we have authentication details, validate them
         if (TBGSettings::getAuthenticationBackend() !== null && TBGSettings::getAuthenticationBackend() !== 'tbg' && $username !== null && $password !== null) {
             TBGLogging::log('Authenticating with backend: ' . TBGSettings::getAuthenticationBackend(), 'auth', TBGLogging::LEVEL_INFO);
             try {
                 $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
                 if ($mod->getType() !== TBGModule::MODULE_AUTH) {
                     TBGLogging::log('Auth module is not the right type', 'auth', TBGLogging::LEVEL_FATAL);
                     throw new Exception('Invalid module type');
                 }
                 if (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                     $row = $mod->verifyLogin($username, $password);
                 } else {
                     $row = $mod->doLogin($username, $password);
                 }
                 if (!$row) {
                     // Invalid
                     TBGContext::getResponse()->deleteCookie('tbg3_username');
                     TBGContext::getResponse()->deleteCookie('tbg3_password');
                     throw new Exception('No such login');
                     //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                 }
             } catch (Exception $e) {
                 throw $e;
             }
         } elseif ($username !== null && $password !== null) {
             TBGLogging::log('Using internal authentication', 'auth', TBGLogging::LEVEL_INFO);
             // First test a pre-encrypted password
             $row = TBGUsersTable::getTable()->getByUsernameAndPassword($username, $password);
             if (!$row) {
                 // Then test an unencrypted password
                 $row = TBGUsersTable::getTable()->getByUsernameAndPassword($username, self::hashPassword($password));
                 if (!$row) {
                     // This is a legacy account from a 2.1 upgrade - try md5
                     $row = TBGUsersTable::getTable()->getByUsernameAndPassword($username, md5($password));
                     if (!$row) {
                         // Invalid
                         TBGContext::getResponse()->deleteCookie('tbg3_username');
                         TBGContext::getResponse()->deleteCookie('tbg3_password');
                         throw new Exception('No such login');
                         //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                     } else {
                         // convert md5 to new password type
                         $user = new TBGUser($row->get(TBGUsersTable::ID), $row);
                         $user->changePassword($password);
                         $user->save();
                         unset($user);
                     }
                 }
             }
         } elseif (TBGContext::isCLI()) {
             $row = TBGUsersTable::getTable()->getByUsername(TBGContext::getCurrentCLIusername());
         } elseif (!TBGSettings::isLoginRequired()) {
             $row = TBGUsersTable::getTable()->getByUserID(TBGSettings::getDefaultUserID());
         }
         if ($row) {
             if (!$row->get(TBGScopesTable::ENABLED)) {
                 throw new Exception('This account belongs to a scope that is not active');
             } elseif (!$row->get(TBGUsersTable::ACTIVATED)) {
                 throw new Exception('This account has not been activated yet');
             } elseif (!$row->get(TBGUsersTable::ENABLED)) {
                 throw new Exception('This account has been suspended');
             }
             $user = TBGContext::factory()->TBGUser($row->get(TBGUsersTable::ID), $row);
         } elseif (TBGSettings::isLoginRequired()) {
             throw new Exception('Login required');
         } else {
             throw new Exception('No such login');
         }
     } catch (Exception $e) {
         throw $e;
     }
     return $user;
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:99,代码来源:TBGUser.class.php

示例7: logout

 /**
  * Log out the current user (does not work when auth method is set to http)
  */
 public static function logout()
 {
     if (TBGSettings::isUsingExternalAuthenticationBackend()) {
         $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
         $mod->logout();
     }
     TBGEvent::createNew('core', 'pre_logout')->trigger();
     self::getResponse()->deleteCookie('tbg3_username');
     self::getResponse()->deleteCookie('tbg3_password');
     self::getResponse()->deleteCookie('tbg3_elevated_password');
     self::getResponse()->deleteCookie('tbg3_persona_session');
     self::getResponse()->deleteCookie('THEBUGGENIE');
     session_regenerate_id(true);
     TBGEvent::createNew('core', 'post_logout')->trigger();
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:18,代码来源:TBGContext.class.php


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