Explorar o código

- Integrated fix for patch #188 - ForceHttps = SecureConnectionRequired

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@670 a333f486-631f-4898-b8df-5754b55c2be0
dflaven %!s(int64=15) %!d(string=hai) anos
pai
achega
cf212707ef
Modificáronse 2 ficheiros con 6 adicións e 2 borrados
  1. 1 2
      application/loginwebpage.class.inc.php
  2. 5 0
      application/utils.inc.php

+ 1 - 2
application/loginwebpage.class.inc.php

@@ -194,8 +194,7 @@ EOF
 
 	static function SecureConnectionRequired()
 	{
-		$oConfig = new Config(ITOP_CONFIG_FILE);
-		return $oConfig->GetSecureConnectionRequired();
+		return utils::GetConfig()->GetSecureConnectionRequired();
 	}
 
 	static function IsConnectionSecure()

+ 5 - 0
application/utils.inc.php

@@ -185,6 +185,11 @@ class utils
 	{
 		// Build an absolute URL to this page on this server/port
 		$sServerName = $_SERVER['SERVER_NAME'];
+		if (self::GetConfig()->GetSecureConnectionRequired())
+		{
+			// If a secure connection is required, then any URL must start with https !
+			$bForceHTTPS = true;
+		}
 		if ($bForceHTTPS)
 		{
 			$sProtocol = 'https';