protected function inactiveUsers(LoginForm &$loginForm)
    {
        if (UsersModule::module()->allowLoginInactiveAccounts === false) {
            return [];
        }
        return [
            'username',
            function ($attribute) use (&$loginForm) {
                if ($loginForm->user !== null && $loginForm->user->is_active === false) {
                    $loginForm->addError($attribute, Yii::t('users', 'You need to confirm your email address'));
                }
            }
        ];
    }