handler function(
 array &arParams
The event "OnAfterUserLoginByHash" fires in the method CUser::LoginByHash() after verification of login arParams['LOGIN'], password cache arParams['HASH'] and user authorization attempt. The parameter arParams['USER_ID'] passes the ID of the user that was successfully authorized, as well as the array with error message arParams['RESULT_MESSAGE'].


arParams Array of fields for login verification and password:
  • USER_ID - ontains user ID on successful authorization
  • RESULT_MESSAGE - array with text describing user verification result. Subsequently used by the function ShowMessage to show message.
  • LOGIN - User login
  • HASH - Password. Special cache from user password. Usually, this cache is stored in the user cookies.

Same 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.
It allows, for example, to update RESULT_MESSAGE, resulting in message update, returned by the function CUser::LoginByHash.

See Also

Example of handler function:

// file /bitrix/php_interface/init.php
// register the handler
AddEventHandler("main", "OnAfterUserLoginByHash", Array("MyClass", "OnAfterUserLoginByHashHandler"));
class MyClass { // create handler "OnAfterUserLoginByHash" function OnAfterUserLoginByHashHandler(&$arParams) { if($arParams['USER_ID']<=0) { //re-define the error message. $arParams['RESULT_MESSAGE'] = Array("MESSAGE" => "New error.", "TYPE" => "ERROR"); } } } ?>

© «Bitrix24», 2001-2022