Add SearchDN error, mark field as required in UI

Signed-off-by: Alexis <60alexis@gmail.com>
This commit is contained in:
Alexis 2021-07-01 10:42:15 +02:00
parent b789674ada
commit d6283ee913
No known key found for this signature in database
GPG Key ID: EBBDA9E42A6966FA
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -61,7 +61,7 @@
<clr-control-error>{{'TOOLTIP.ITEM_REQUIRED' | translate}}</clr-control-error> <clr-control-error>{{'TOOLTIP.ITEM_REQUIRED' | translate}}</clr-control-error>
</clr-input-container> </clr-input-container>
<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-tooltip>
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon> <clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
<clr-tooltip-content clrPosition="top-right" clrSize="lg" *clrIfOpen> <clr-tooltip-content clrPosition="top-right" clrSize="lg" *clrIfOpen>