diff --git a/htdocs/login_form.php b/htdocs/login_form.php index f16bdbf..37f0e38 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -16,7 +16,19 @@ printf('

%s %s

',_('Authenticate to server'),$app['server'] echo '
'; # Check for a secure connection -if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') { +$isHTTPS = false; + +# Check if the current connection is encrypted +if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { + $isHTTPS = true; +} +# Check if a proxy server downstream does encryption for us +elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) +== 'on') { + $isHTTPS = false; +} + +if (!$isHTTPS) { echo '
'; printf('%s: %s.', _('You are not using \'https\'. Web browser will transmit login information in clear text.'), @@ -25,6 +37,7 @@ if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') { echo '
'; } +unset($isSecure); # HTTP Basic Auth Form. if ($app['server']->getAuthType() == 'http') {