handler function(
 array &arParams

The event "OnBeforeUserLoginByHash" fires in the method CUser::LoginByHash() before the attempt to authorize the user (before the login arParams['LOGIN'], and password are both arParams['HASH'] verified).


arParams Array of fields to check login and password:
  • LOGIN - user login.
  • HASH - special cache for user password. This cache is usually stored in the user cookies.

Note All parameters passed to this handler function are references to original variables. Therefore, all changes to parameters made within the handler affect values of the original variables.

Returned value

To cancel user authorization and terminate the execution for the method CUser::LoginByHash, throw an exception in the handler function via the method $APPLICATION->ThrowException() and return false.

See Also

Example of handler function:

// file /bitrix/php_interface/init.php
// register the handler  
AddEventHandler("main", "OnBeforeUserLoginByHash", Array("MyClass", "OnBeforeUserLoginByHashHandler"));
class MyClass { // create event handler "OnBeforeUserLoginByHash" public static function OnBeforeUserLoginByHashHandler(&$arParams) { // execute any linked actions here if(strtolower($arParams['LOGIN'])=="guest") { global $APPLICATION; $APPLICATION->throwException("User with the Guest login cannot login via cache."); return false; } } } ?>

© «Bitrix24», 2001-2024