Merge branch '4.7' into 4

This commit is contained in:
Steve Boyd 2021-04-19 16:39:15 +12:00
commit 3d7868449f

View File

@ -938,12 +938,13 @@ class Director implements TemplateGlobalProvider
public static function absoluteBaseURLWithAuth(HTTPRequest $request = null) public static function absoluteBaseURLWithAuth(HTTPRequest $request = null)
{ {
// Detect basic auth // Detect basic auth
$login = '';
if ($request) {
$user = $request->getHeader('PHP_AUTH_USER'); $user = $request->getHeader('PHP_AUTH_USER');
if ($user) { if ($user) {
$password = $request->getHeader('PHP_AUTH_PW'); $password = $request->getHeader('PHP_AUTH_PW');
$login = sprintf("%s:%s@", $user, $password) ; $login = sprintf("%s:%s@", $user, $password);
} else { }
$login = '';
} }
return Director::protocol($request) . $login . static::host($request) . Director::baseURL(); return Director::protocol($request) . $login . static::host($request) . Director::baseURL();