S
S
Sp1keazyYT2018-07-08 21:33:27
1C-Bitrix
Sp1keazyYT, 2018-07-08 21:33:27

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

1 answer(s)
K
Kudis, 2018-07-09
@kudis

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 question

Ask a Question

731 491 924 answers to any question