Merge pull request #15196 from sixeIa/fix-basedn-empty

Add SearchDN error, mark field as required in UI
This commit is contained in:
Daniel Jiang 2021-07-12 12:32:52 +08:00 committed by GitHub
commit 3e502ec9a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -53,6 +53,9 @@ var ErrInvalidFilter = errors.New("invalid filter syntax")
// ErrEmptyBaseDN ...
var ErrEmptyBaseDN = errors.New("empty base dn")
// ErrEmptySearchDN ...
var ErrEmptySearchDN = errors.New("empty search dn")
// Session - define a LDAP session
type Session struct {
basicCfg models.LdapConf
@ -125,7 +128,7 @@ func TestConfig(ldapConfig models.LdapConf) (bool, error) {
defer ts.Close()
if ts.basicCfg.SearchDn == "" {
return false, ErrEmptyBaseDN
return false, ErrEmptySearchDN
}
if err := ts.Bind(ts.basicCfg.SearchDn, ts.basicCfg.SearchPassword); err != nil {
if goldap.IsErrorWithCode(err, goldap.LDAPResultInvalidCredentials) {

View File

@ -61,7 +61,7 @@
<clr-control-error>{{'TOOLTIP.ITEM_REQUIRED' | translate}}</clr-control-error>
</clr-input-container>
<clr-input-container>
<label for="ldapSearchDN" >{{'CONFIG.LDAP.SEARCH_DN' | translate}}
<label for="ldapSearchDN" class="required">{{'CONFIG.LDAP.SEARCH_DN' | translate}}
<clr-tooltip>
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
<clr-tooltip-content clrPosition="top-right" clrSize="lg" *clrIfOpen>