RomanL 8 лет назад
Родитель
Сommit
c17aff9d10
2 измененных файлов с 23 добавлено и 27 удалено
  1. 13 13
      inc/profiles.inc.php
  2. 10 14
      modules/boonex/accounts/classes/BxAccntGridAdministration.php

+ 13 - 13
inc/profiles.inc.php

@@ -186,21 +186,21 @@ function bx_check_password($sLogin, $sPassword, $iRole = BX_DOL_ROLE_MEMBER)
             'password' => &$sPassCheck,
         ));
     
-	$iMaxLoginAttempts = getParam('sys_account_limit_incorrect_login_attempts');
-    if ($iMaxLoginAttempts >0){
-        $oAccountQuery = BxDolAccountQuery::getInstance();
-        if ($aAccountInfo['login_attempts'] >= $iMaxLoginAttempts){
-            $oAccountQuery->lockAccount($aAccountInfo['id'], 1);
-            bx_import('BxDolLanguages');
-            return _t("_sys_txt_login_locked", BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password'));
+    if ($sErrorMsg = bx_check_login($aAccountInfo['id'], $sPassCheck, $iRole)){
+        $iMaxLoginAttempts = getParam('sys_account_limit_incorrect_login_attempts');
+        if ($iMaxLoginAttempts >0){
+            $oAccountQuery = BxDolAccountQuery::getInstance();
+            if ($aAccountInfo['login_attempts'] >= $iMaxLoginAttempts){
+                $oAccountQuery->lockAccount($aAccountInfo['id'], 1);
+                bx_import('BxDolLanguages');
+                return _t("_sys_txt_login_locked", BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password'));
+            }
+            else{
+                $oAccountQuery->updateAttemptsCounter($aAccountInfo['id']);
+            }
         }
-        else{
-            $oAccountQuery->updateAttemptsCounter($aAccountInfo['id']);
-        }
-    }
-    
-    if ($sErrorMsg = bx_check_login($aAccountInfo['id'], $sPassCheck, $iRole))
         return $sErrorMsg;
+    }
 
     // Admin can always login even if he is blocked/banned/suspended/etc
     if (isAdmin($aAccountInfo['id']))

+ 10 - 14
modules/boonex/accounts/classes/BxAccntGridAdministration.php

@@ -197,20 +197,16 @@ class BxAccntGridAdministration extends BxBaseModProfileGridAdministration
             echoJson(array());
             return;
         }
-
-        $iId = $aIds[0];
-        $oAccount = BxDolAccount::getInstance($iId);
-        if(!$oAccount)
-            return echoJson(array());
-        $aRes = array();
-        if ($oAccount->isLocked()){
-            $oAccountQuery = BxDolAccountQuery::getInstance();
-            $oAccountQuery->unlockAccount($iId);
-            $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
-        }
-        else{
-            $aRes = array('msg' => _t('_bx_accnt_grid_action_unlock_error'));
-        }
+		$oAccountQuery = BxDolAccountQuery::getInstance();
+		foreach($aIds as $iId){
+			$oAccount = BxDolAccount::getInstance($iId);
+			if(!$oAccount)
+				continue;
+			if ($oAccount->isLocked()){
+				$oAccountQuery->unlockAccount($iId);
+			}
+		}
+		$aRes = array('grid' => $this->getCode(false), 'blink' => $aIds);
         return echoJson($aRes);
     }