OnBeforeUserLogin
bool handler function( array &arParams );The event OnBeforeUserLogin event is fired in the method CUser::Login before a user authorization attempt (before the login arParams['LOGIN'], and password arParams['PASSWORD'] are both verified) This event can be used to terminate verification process and to re-define specific fields.
Parameters
Parameter | Description |
---|---|
arParams |
Array of fields to verify login and password:
|
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 undo user authorization and terminate the execution for the method CUser::SimpleRegister, throw an exception in the handler function via the methodSee Also
- "OnAfterUserLogin" event
- CUser::Login
- Events
- External Authorization
Example of handler function:
<? // file /bitrix/php_interface/init.php // register the handler AddEventHandler("main", "OnBeforeUserLogin", Array("MyClass", "OnBeforeUserLoginHandler"));
class MyClass { // create the event handler "OnBeforeUserLogin" public static function OnBeforeUserLoginHandler(&$arFields) { // execute any linked actions if(strtolower($arFields["LOGIN"])=="guest") { global $APPLICATION; $APPLICATION->throwException("User with the Guest login cannot be authorized."); return false; } } } ?>
© «Bitrix24», 2001-2023