flask_ldap3_login/forms.py
def validate_ldap(self):
        logging.debug('Validating LDAPLoginForm against LDAP')
        'Validate the username/password data against ldap directory'
        ldap_mgr = current_app.ldap3_login_manager
        username = self.username.data
        password = self.password.data

        result = ldap_mgr.authenticate(username, password)

        if result.status == AuthenticationResponseStatus.success:
            self.user = ldap_mgr._save_user(
                result.user_dn,
                result.user_id,
                result.user_info,
                result.user_groups
            )
            return True

        else:
            self.user = None
            self.username.errors.append('Invalid Username/Password.')
            self.password.errors.append('Invalid Username/Password.')
            return False
def validate_ldap(self):
        logging.debug('Validating LDAPLoginForm against LDAP')
        'Validate the username/password data against ldap directory'
        ldap_mgr = current_app.ldap3_login_manager
        username = self.username.data
        password = self.password.data

        result = ldap_mgr.authenticate(username, password)

        if result.status == AuthenticationResponseStatus.success:
            self.user = ldap_mgr._save_user(
                result.user_dn,
                result.user_id,
                result.user_info,
                result.user_groups
            )
            return True

        else:
            self.user = None
            self.username.errors.append('Invalid Username/Password.')
            self.password.errors.append('Invalid Username/Password.')
            return False
Validate the username/password data against ldap directory