You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ldap.go
    path of file: ./repos/jiacrontab/jiacrontab_admin
    
    the code of the file until where you have to start completion: package admin

import (
	"fmt"
	"jiacrontab/models"
	"time"

	"errors"

	ld "github.com/go-ldap/ldap/v3"
)

type Ldap struct {
	BindUserDn             string
	BindPwd     
    
func (l *Ldap) Login(username string, password string) (*models.User, error) {
	err := l.loadLdapFields()
	if err != nil {
		return nil, err
	}

	conn, err := l.connect()
	if err != nil {
		return nil, err
	}
	defer conn.Close()

	if l.DisabledAnonymousQuery {
		err := conn.Bind(l.BindUserDn, l.BindPwd)
		if err != nil {
			return nil, err
		}
	}
	query := ld.NewSearchRequest(
		l.BaseOn,
		ld.ScopeWholeSubtree,
		ld.DerefAlways,
		0, 0, false,
		fmt.Sprintf("(%v=%v)", l.UserField, username),
		l.queryFields, nil,
	)
	ret, err := conn.Search(query)

	if err != nil {
		return nil, fmt.Errorf("在Ldap搜索用户失败 - %v", err)
	}
	if len(ret.Entries) == 0 {
		return nil, fmt.Errorf("在Ldap中未查询到对应的用户信息 - %v", err)
	}

	err = conn.Bind(ret.Entries[0].DN, password)
	if err != nil {
		return nil, errors.New("帐号或密码不正确")
	}
	return l.convert(ret.Entries[0])
}