mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Add RASPI_AUTH_ENABLED flag to config #280
This commit is contained in:
parent
e5778ba01c
commit
d76984517c
@ -29,10 +29,13 @@ define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf');
|
||||
define('RASPI_ACCESS_CHECK_IP', '1.1.1.1');
|
||||
define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one');
|
||||
|
||||
// Constant for the 5GHz wireless regulatory domain
|
||||
// Constants for the 5GHz wireless regulatory domain.
|
||||
define('RASPI_5GHZ_ISO_ALPHA2', array('NL','US'));
|
||||
define('RASPI_5GHZ_MAX_CHANNEL', 165);
|
||||
|
||||
// Enable basic authentication for the web admin.
|
||||
define('RASPI_AUTH_ENABLED', true);
|
||||
|
||||
// Optional services, set to true to enable.
|
||||
define('RASPI_WIFICLIENT_ENABLED', true);
|
||||
define('RASPI_HOTSPOT_ENABLED', true);
|
||||
|
@ -5,8 +5,8 @@ $pass = $_SERVER['PHP_AUTH_PW'] ?? "";
|
||||
require_once RASPI_CONFIG.'/raspap.php';
|
||||
$config = getConfig();
|
||||
|
||||
if (RASPI_AUTH_ENABLED) {
|
||||
$validated = ($user == $config['admin_user']) && password_verify($pass, $config['admin_pass']);
|
||||
|
||||
if (!$validated) {
|
||||
header('WWW-Authenticate: Basic realm="RaspAP"');
|
||||
if (function_exists('http_response_code')) {
|
||||
@ -15,6 +15,8 @@ if (!$validated) {
|
||||
} else {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
}
|
||||
|
||||
exit('Not authorized'.PHP_EOL);
|
||||
}
|
||||
} else {
|
||||
$validated = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user