Stack Exchange
LDAP connection using ldapjs library
While working on my work-project, admin rathered to create a login form with AC (LDAP) connection to their server with stored data with each customer of the firma. Code of query connection is below:
'use strict';

import ldap from 'ldapjs';
import CustomStorage from '../../services/Storage/Local-Storage.js';

const Storage = new CustomStorage();

const passwordInput: HTMLInputElement | null = document.querySelector('#password-input');
const loginInput: HTMLInputElement | null = document.querySelector('#login-input');
const logInBtn: HTMLButtonElement | null = document.querySelector('#login-button');
const loginModal = document.querySelector('#login-modal');
const loginOverlay = document.querySelector('#login-overlay');
const passwordWrapper: HTMLDivElement | null = document.querySelector('#password-wrapper');
const savePasswordCheckboxInput: HTMLInputElement | null = document.querySelector('#save-password-checkbox-input');

const ldapServerURL = 'ldap://example.server';
const ldapBaseDN = 'cn=Bob Marlen, ou=ExampleFolder, dc=ExampleGroup, dc=ExampleGroup';

export default function LoginWindow() {

    loginOverlay?.setAttribute('style', 'display: flex');

    logInBtn?.addEventListener('click', () => {
        Storage.setItem('login', loginInput?.value);
        Storage.setItem('password', passwordInput?.value);

        const client = ldap.createClient({
            url: ldapServerURL,
        });

        const password: string | undefined = passwordInput?.value;

        if (password) {
            client.bind(ldapBaseDN, password, (error) => {
                if (error && loginModal && loginOverlay) {
                    const throwErr = document.createElement('p');

                    passwordWrapper?.setAttribute('style', 'border: 1px solid red;');

                    passwordWrapper?.classList.add('shake-animation');

                    throwErr.setAttribute('id', 'error-msg');
                    throwErr.textContent = 'Typed password is incorrect';

                    setTimeout(() => {
                        passwordWrapper?.style.removeProperty('border');
                        throwErr.remove();
                    }, 2500);

                    setTimeout(() => {
                        passwordWrapper?.classList.remove('shake-animation');
                    }, 350);

                    loginModal?.appendChild(throwErr);
                    loginOverlay?.appendChild(loginModal);
                    document.body.appendChild(loginOverlay);
                } else {
                    if (savePasswordCheckboxInput?.checked) {
                        sessionStorage.setItem('login', Storage.items.login);
                        sessionStorage.setItem('password', Storage.items.password);
                    }

                    loginOverlay?.remove();
                }
            });
        }

        client.unbind((error) => {
            if (error) {
                console.error('Error unbinding from LDAP server:', error);
            }
        });
    });
}


So here is the source code. And the example of mistake below:
please ignore the mistakes w/ server response. The main mistake is this one.
After checking all of that mistakes, found out that I don't know what's wrong with it.
I have tried to remove some elements from there, tried to search out what is that elemenets are, but nothing helped.
Important
I'm using Vite for loading a specific libraries for Node.js. The language of coding - TypeScript
Vite is starting by npm run client and Vite work supported by express.js
I will be realy glad and thankfull for your help, even for few mindfull words which could help me figure out with this problem.
Have a nice day, and thank you for your time!

What is 'rathered ' supposed to mean? Because it doesn't.

yeah, struggles of speaking few languages. He advised to me use AC (LDAP)
