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


PHP eZUser::isTrusted方法代码示例

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


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

示例1: setFailedLoginAttempts

 static function setFailedLoginAttempts($userID, $value = false, $setByForce = false)
 {
     $trustedUser = eZUser::isTrusted();
     // If user is trusted we should stop processing
     if ($trustedUser and !$setByForce) {
         return true;
     }
     $maxNumberOfFailedLogin = eZUser::maxNumberOfFailedLogin();
     if ($maxNumberOfFailedLogin == '0' and !$setByForce) {
         return true;
     }
     $userID = (int) $userID;
     $userObject = eZUser::fetch($userID);
     if (!$userObject) {
         return true;
     }
     $isEnabled = $userObject->isEnabled();
     // If current user is disabled we should not continue
     if (!$isEnabled and !$setByForce) {
         return true;
     }
     $db = eZDB::instance();
     $db->begin();
     $userVisitArray = $db->arrayQuery("SELECT 1 FROM ezuservisit WHERE user_id={$userID}");
     if (isset($userVisitArray[0])) {
         if ($value === false) {
             $failedLoginAttempts = $userObject->failedLoginAttempts();
             $failedLoginAttempts += 1;
         } else {
             $failedLoginAttempts = (int) $value;
         }
         $db->query("UPDATE ezuservisit SET failed_login_attempts={$failedLoginAttempts} WHERE user_id={$userID}");
     } else {
         if ($value === false) {
             $failedLoginAttempts = 1;
         } else {
             $failedLoginAttempts = (int) $value;
         }
         $db->query("INSERT INTO ezuservisit ( failed_login_attempts, user_id ) VALUES ( {$failedLoginAttempts}, {$userID} )");
     }
     $db->commit();
     eZContentCacheManager::clearContentCacheIfNeeded($userID);
     eZContentCacheManager::generateObjectViewCache($userID);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:44,代码来源:ezuser.php

示例2:

    // called from outside of a template (?)
    $requestedURI = $GLOBALS['eZRequestedURI'];
    if ($requestedURI instanceof eZURI) {
        $requestedModule = $requestedURI->element(0, false);
        $requestedView = $requestedURI->element(1, false);
        if ($requestedModule != 'user' or $requestedView != 'login') {
            $userRedirectURI = $requestedURI->originalURIString(false);
        }
    }
}
if ($http->hasPostVariable("RegisterButton")) {
    $Module->redirectToView('register');
}
$userIsNotAllowedToLogin = false;
$failedLoginAttempts = false;
$maxNumOfFailedLogin = !eZUser::isTrusted() ? eZUser::maxNumberOfFailedLogin() : false;
// Should we show message about failed login attempt and max number of failed login
if ($loginWarning and isset($GLOBALS['eZFailedLoginAttemptUserID'])) {
    $showMessageIfExceeded = $ini->hasVariable('UserSettings', 'ShowMessageIfExceeded') ? $ini->variable('UserSettings', 'ShowMessageIfExceeded') == 'true' : false;
    $failedUserID = $GLOBALS['eZFailedLoginAttemptUserID'];
    $failedLoginAttempts = eZUser::failedLoginAttemptsByUserID($failedUserID);
    $canLogin = eZUser::isEnabledAfterFailedLogin($failedUserID);
    if ($showMessageIfExceeded and !$canLogin) {
        $userIsNotAllowedToLogin = true;
    }
}
$tpl = eZTemplate::factory();
$tpl->setVariable('login', $userLogin, 'User');
$tpl->setVariable('post_data', $postData, 'User');
$tpl->setVariable('password', $userPassword, 'User');
$tpl->setVariable('redirect_uri', $userRedirectURI, 'User');
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:login.php


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