Answer the question
In order to leave comments, you need to log in
How to get the login value used when registering a user in the OnBeforeUserRegister handler function?
Hello. I am writing now a check for the number of login characters so that accounts with a login of more than 16 characters are not registered. I do not understand how to take the values of the Login field, which is located in the authorization form?
Answer the question
In order to leave comments, you need to log in
I advise another event, even 2:
AddEventHandler('main', 'OnBeforeUserUpdate', ['Kudis', 'checkLogin']);
AddEventHandler('main', 'OnBeforeUserAdd', ['Kudis', 'checkLogin']);
class Kudis
{
public static function checkLogin($arFields)
{
if (strlen($arFields['LOGIN']) < 10)
{
$GLOBALS['APPLICATION']->ThrowException('Слишком короткий логин!');
return false;
}
return true;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question