AY's Macbook Pro 3 år sedan
förälder
incheckning
170cc96693
2 ändrade filer med 6 tillägg och 15 borttagningar
  1. 6 14
      mod/auth/ldap/ldap.go
  2. 0 1
      web/SystemAO/advance/ldap.html

+ 6 - 14
mod/auth/ldap/ldap.go

@@ -31,7 +31,6 @@ type ldapHandler struct {
 
 type Config struct {
 	Enabled      bool   `json:"enabled"`
-	AutoRedirect bool   `json:"auto_redirect"`
 	BindUsername string `json:"bind_username"`
 	BindPassword string `json:"bind_password"`
 	FQDN         string `json:"fqdn"`
@@ -88,11 +87,6 @@ func (ldap *ldapHandler) ReadConfig(w http.ResponseWriter, r *http.Request) {
 		common.SendTextResponse(w, "Invalid config value [key=enabled].")
 		return
 	}
-	autoredirect, err := strconv.ParseBool(ldap.readSingleConfig("autoredirect"))
-	if err != nil {
-		common.SendTextResponse(w, "Invalid config value [key=autoredirect].")
-		return
-	}
 	//get the LDAP config from db
 	BindUsername := ldap.readSingleConfig("BindUsername")
 	BindPassword := ldap.readSingleConfig("BindPassword")
@@ -102,7 +96,6 @@ func (ldap *ldapHandler) ReadConfig(w http.ResponseWriter, r *http.Request) {
 	//marshall it and return
 	config, err := json.Marshal(Config{
 		Enabled:      enabled,
-		AutoRedirect: autoredirect,
 		BindUsername: BindUsername,
 		BindPassword: BindPassword,
 		FQDN:         FQDN,
@@ -230,25 +223,24 @@ func (ldap *ldapHandler) convertGroup(ldapUser *ldap.Entry) UserAccount {
 func (ldap *ldapHandler) TestConnection(w http.ResponseWriter, r *http.Request) {
 	//marshall it and return the connection status
 	userList, err := ldap.getAllUser(10)
-	log.Println(userList, err)
 	if err != nil {
-		empty, err := json.Marshal(syncorizeUserReturnInterface{})
+		errMessage, err := json.Marshal(syncorizeUserReturnInterface{Error: err.Error()})
 		if err != nil {
-			common.SendErrorResponse(w, "Error while marshalling information")
+			common.SendErrorResponse(w, "{\"error\":\"Error while marshalling information\"}")
 			return
 		}
-		common.SendJSONResponse(w, string(empty))
+		common.SendJSONResponse(w, string(errMessage))
 		return
 	}
 	returnJSON := syncorizeUserReturnInterface{Userinfo: userList, Length: len(userList), Error: ""}
 	accountJSON, err := json.Marshal(returnJSON)
 	if err != nil {
-		empty, err := json.Marshal(syncorizeUserReturnInterface{})
+		errMessage, err := json.Marshal(syncorizeUserReturnInterface{Error: err.Error()})
 		if err != nil {
-			common.SendErrorResponse(w, "Error while marshalling information")
+			common.SendErrorResponse(w, "{\"error\":\"Error while marshalling information\"}")
 			return
 		}
-		common.SendJSONResponse(w, string(empty))
+		common.SendJSONResponse(w, string(errMessage))
 		return
 	}
 	common.SendJSONResponse(w, string(accountJSON))

+ 0 - 1
web/SystemAO/advance/ldap.html

@@ -148,7 +148,6 @@
         function update() {
             $.post("../../system/auth/ldap/config/write", {
                     enabled: $("#enable").parent().checkbox("is checked"),
-                    autoredirect: $("#autoredirect").parent().checkbox("is checked"),
                     bind_username: $("#bind_username").val(),
                     bind_password: $("#bind_password").val(),
                     fqdn: $("#fqdn").val(),