Răsfoiți Sursa

Merge pull request #634 from causefx/cero-dev

LDAP and Settings fix
causefx 8 ani în urmă
părinte
comite
359b326f98
10 a modificat fișierele cu 48 adăugiri și 10 ștergeri
  1. 1 0
      config/configDefaults.php
  2. 20 7
      functions.php
  3. 2 0
      lang/de.ini
  4. 3 1
      lang/en.ini
  5. 2 0
      lang/es.ini
  6. 2 0
      lang/fr.ini
  7. 2 0
      lang/it.ini
  8. 2 0
      lang/nl.ini
  9. 2 0
      lang/pl.ini
  10. 12 2
      settings.php

+ 1 - 0
config/configDefaults.php

@@ -95,4 +95,5 @@ return array(
 	"chatAuth" => "false",
 	"installedTheme" => "",
 	"calendarRefresh" => "60000",
+	"authBackendDomainFormat" => "",
 );

+ 20 - 7
functions.php

@@ -34,14 +34,27 @@ if (function_exists('ldap_connect')) :
 		
 		// returns true or false
 		$ldap = ldap_connect(implode(' ',$ldapServers));
-		if ($bind = ldap_bind($ldap, AUTHBACKENDDOMAIN.'\\'.$username, $password)) {
-   			writeLog("success", "LDAP authentication success"); 
-			return true;
-		} else {
-   			writeLog("error", "LDPA could not authenticate"); 
-			return false;
+		if(empty(AUTHBACKENDDOMAINFORMAT)){
+			if ($bind = ldap_bind($ldap, AUTHBACKENDDOMAIN.'\\'.$username, $password)) {
+				writeLog("success", "LDAP authentication success"); 
+				return true;
+			} else {
+				writeLog("error", "LDAP could not authenticate"); 
+				return false;
+			}
+		}else{
+			ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
+			ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
+			$bind = ldap_bind($ldap, sprinf(AUTHBACKENDDOMAINFORMAT, $username), $password);
+			if ($bind) {
+				writeLog("success", "LDAP authentication success"); 
+				return true;
+			} else {
+				writeLog("error", "LDPA could not authenticate"); 
+				return false;
+			}			
 		}
-  		writeLog("error", "LDPA could not authenticate");      
+  		writeLog("error", "LDAP could not authenticate");      
 		return false;
 	}
 else :

+ 2 - 0
lang/de.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 3 - 1
lang/en.ini

@@ -230,7 +230,7 @@ AUTHBACKEND = "Select backend to use"
 AUTHBACKENDCREATE = "Should accounts be created in Organizr if successfully authenticated against backend"
 AUTHBACKENDHOST = "http(s)://192.168.1.100"
 AUTHBACKENDPORT = "Backend Port (eg 21 for FTP, 389 for LDAP, 8096 for Emby)"
-AUTHBACKENDDOMAIN = "Domain to use for LDAP"
+AUTHBACKENDDOMAIN = "Basi Domain to use for LDAP"
 PLEX_USERNAME = "Plex Username"
 PLEX_PASSWORD = "Plex Password"
 BOTH = "Plus Other"
@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 2 - 0
lang/es.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 2 - 0
lang/fr.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 2 - 0
lang/it.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 2 - 0
lang/nl.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 2 - 0
lang/pl.ini

@@ -326,3 +326,5 @@ LESS = "Less"
 ENABLE_SPLASH_SCREEN = "Enable Splash Screen"
 ENABLE_CHAT = "Enable Chat"
 CHAT_AUTH = "Minimum authentication level to access Chat"
+AUTHBACKENDDOMAINFORMAT = "Advanced Domain to use for LDAP i.e. uid=s,ou=People,dc=example,dc=com"
+TOGGLE_ALL = "Toggle All"

+ 12 - 2
settings.php

@@ -549,7 +549,7 @@ if($userDevice !== "phone"){ echo "<br><br><br>".buildMenu($buildMenu); }else{ e
 												<span class="btn-label"><i class="fa fa-check"></i></span><?php echo $language->translate("CHECK_FRAME");?>
 											</button>
                                             <button id="toggleAllExtra" type="button" class="btn waves btn-labeled btn-info btn-sm text-uppercase waves-effect waves-float indigo-bg">
-												<span class="btn-label"><i class="fa fa-toggle-off"></i></span><span class="btn-text">Toggle All Tab Info</span>
+												<span class="btn-label"><i class="fa fa-toggle-off"></i></span><span class="btn-text"><?php echo $language->translate("TOGGLE_ALL");?></span>
 											</button>
 										</div>
 										<input type="file" name="files[]" id="uploadIcons" multiple="multiple">
@@ -1501,6 +1501,14 @@ echo buildSettings(
 						'name' => 'authBackendDomain',
 						'class' => 'be-auth be-auth-ldap',
 						'value' => AUTHBACKENDDOMAIN,
+                    ),
+                    array(
+						'type' => 'text',
+						'placeholder' => 'domain & format',
+						'labelTranslate' => 'AUTHBACKENDDOMAINFORMAT',
+						'name' => 'authBackendDomainFormat',
+						'class' => 'be-auth be-auth-ldap',
+						'value' => AUTHBACKENDDOMAINFORMAT,
 					),
 					array(
 						'type' => 'text',
@@ -3771,7 +3779,9 @@ echo buildSettings(
             });
             $(".email-content").niceScroll({
                 railpadding: {top:0,right:0,left:0,bottom:0},
-                grabcursorenabled: false
+                railoffset: {top:75,right:0,left:0,bottom:75},
+                grabcursorenabled: false,
+                zindex: 1101
             });
             $("textarea").niceScroll({
                 railpadding: {top:0,right:0,left:0,bottom:0},