Basic auth realms now work for Nginx Vhosts too

This commit is contained in:
Churro
2014-12-01 22:48:54 +01:00
parent 3be43c4848
commit adbc4bc402

View File

@@ -619,7 +619,7 @@ class nginx {
break; break;
default: default:
if ($single['path'] == '/') { if ($single['path'] == '/') {
$path_options .= "\t\t" . 'auth_basic "Restricted Area";' . "\n"; $path_options .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
$path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n"; $path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n";
// remove already used entries so we do not have doubles // remove already used entries so we do not have doubles
unset($htpasswds[$idx]); unset($htpasswds[$idx]);
@@ -679,7 +679,7 @@ class nginx {
break; break;
default: default:
$path_options .= "\t" . 'location ' . makeCorrectDir($single['path']) . ' {' . "\n"; $path_options .= "\t" . 'location ' . makeCorrectDir($single['path']) . ' {' . "\n";
$path_options .= "\t\t" . 'auth_basic "Restricted Area";' . "\n"; $path_options .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
$path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n"; $path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n";
$path_options .= "\t".'}' . "\n"; $path_options .= "\t".'}' . "\n";
} }
@@ -728,6 +728,7 @@ class nginx {
$returnval[$x]['path'] = $path; $returnval[$x]['path'] = $path;
$returnval[$x]['root'] = makeCorrectDir($domain['documentroot']); $returnval[$x]['root'] = makeCorrectDir($domain['documentroot']);
$returnval[$x]['authname'] = $row_htpasswds['authname'];
$returnval[$x]['usrf'] = $htpasswd_filename; $returnval[$x]['usrf'] = $htpasswd_filename;
$x++; $x++;
} }
@@ -819,7 +820,7 @@ class nginx {
} }
$stats_text .= "\t\t" . 'alias ' . $alias_dir . ';' . "\n"; $stats_text .= "\t\t" . 'alias ' . $alias_dir . ';' . "\n";
$stats_text .= "\t\t" . 'auth_basic "Restricted Area";' . "\n"; $stats_text .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
$stats_text .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n"; $stats_text .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';'."\n";
$stats_text .= "\t" . '}' . "\n\n"; $stats_text .= "\t" . '}' . "\n\n";