mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 18:55:18 +01:00
fix issue7793: ping ldap server is always success (#7795)
Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
commit
3be14b7997
@ -79,10 +79,10 @@ func (l *LdapAPI) Prepare() {
|
|||||||
|
|
||||||
// Ping ...
|
// Ping ...
|
||||||
func (l *LdapAPI) Ping() {
|
func (l *LdapAPI) Ping() {
|
||||||
|
var err error
|
||||||
var ldapConfs = models.LdapConf{
|
var ldapConfs = models.LdapConf{
|
||||||
LdapConnectionTimeout: 5,
|
LdapConnectionTimeout: 5,
|
||||||
}
|
}
|
||||||
var err error
|
|
||||||
|
|
||||||
l.Ctx.Input.CopyBody(1 << 32)
|
l.Ctx.Input.CopyBody(1 << 32)
|
||||||
|
|
||||||
@ -90,7 +90,8 @@ func (l *LdapAPI) Ping() {
|
|||||||
ldapSession := *l.ldapConfig
|
ldapSession := *l.ldapConfig
|
||||||
err = ldapSession.ConnectionTest()
|
err = ldapSession.ConnectionTest()
|
||||||
} else {
|
} else {
|
||||||
isValid, err := l.DecodeJSONReqAndValidate(&ldapConfs)
|
var isValid bool
|
||||||
|
isValid, err = l.DecodeJSONReqAndValidate(&ldapConfs)
|
||||||
if !isValid {
|
if !isValid {
|
||||||
l.SendBadRequestError(err)
|
l.SendBadRequestError(err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user