Skip to content

Commit

Permalink
Ticket #4796 - Infinite loop in code of Need Change Password feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Sep 9, 2024
1 parent babe086 commit 862c8ae
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions inc/classes/BxDolAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ public function addInformerPermanentMessages ($oInformer)
$oInformer->add('sys-account-unconfirmed-phone', _t('_sys_txt_account_unconfirmed_phone', $sUrl), BX_INFORMER_ALERT);
}
}
$this->isNeedChangePassword();

$this->isNeedChangePassword(false, $oInformer);
}

/**
Expand Down Expand Up @@ -885,7 +886,7 @@ public function getPasswordExpiredDateByAccount($iAccountId = false)
return $this->getPasswordExpiredDate($iPasswordExpiredForMembership, $iAccountId);
}

public function isNeedChangePassword($iAccountId = false)
public function isNeedChangePassword($iAccountId = false, $oInformer = false)
{
$iAccountId = (int)$iAccountId ? (int)$iAccountId : $this->_iAccountID;

Expand All @@ -907,15 +908,17 @@ public function isNeedChangePassword($iAccountId = false)
* - `override_result` - [bool] by ref, if Need Redirect To Change Password = true, otherwise = false, can be overridden in hook processing
* @hook @ref hook-account-is_need_to_change_password
*/
bx_alert('account', 'is_need_to_change_password', $iAccountId, false, array('override_result' => &$bNeedRedirectToChangePassword));
bx_alert('account', 'is_need_to_change_password', $iAccountId, false, ['override_result' => &$bNeedRedirectToChangePassword]);

if ($aAccountInfo['password_expired'] >0 && $aAccountInfo['password_expired'] < time() && $bNeedRedirectToChangePassword){
if ($aAccountInfo['password_expired'] > 0 && $aAccountInfo['password_expired'] < time() && $bNeedRedirectToChangePassword) {
if (getParam('sys_account_accounts_force_password_change_after_expiration') == 'on'){
header('Location: ' . BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=account-settings-password'));
exit;
}
else{
$oInformer = BxDolInformer::getInstance(BxDolTemplate::getInstance());
else {
if(!$oInformer)
$oInformer = BxDolInformer::getInstance();

$oInformer->add('sys-account-need-to-change-password', _t('_sys_txt_account_need_to_change_password', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=account-settings-password')), BX_INFORMER_ALERT);
}
}
Expand Down

0 comments on commit 862c8ae

Please sign in to comment.