diff --git a/index.php b/index.php index 3e22474ac..aad5e80ae 100644 --- a/index.php +++ b/index.php @@ -168,7 +168,7 @@ // Captive portal (android working, no luck on iOS yet) if ($route->controller=="generate_204" || $route->controller=="hotspot-detect") { - header('Location: /'); + header('Location: http://192.168.42.1'); exit; } // if (get('q')=="library/test/success.html") { header('Location: /'); exit; } @@ -206,11 +206,18 @@ if (file_exists("Modules/setup")) { require "Modules/setup/setup_model.php"; $setup = new Setup($mysqli); + if ($setup->status()=="unconfigured") { - $settings["interface"]["default_controller"] = "setup"; - $settings["interface"]["default_action"] = ""; // Provide special setup access to WIFI module functions $_SESSION['setup_access'] = true; + } else { + $_SESSION['setup_access'] = false; + } + + // Either show setup interface if unconfigured or if access point login + if ($setup->status()=="unconfigured" || $route->is_ap) { + $settings["interface"]["default_controller"] = "setup"; + $settings["interface"]["default_action"] = ""; } } } diff --git a/route.php b/route.php index 6eb8c861d..0dc48fe40 100644 --- a/route.php +++ b/route.php @@ -57,6 +57,11 @@ class Route */ public $is_ajax = false; + /** + * @var bool + */ + public $is_ap = false; + /** * @param string $q * @param string $documentRoot @@ -67,6 +72,11 @@ public function __construct($q, $documentRoot, $requestMethod) $this->decode($q, $documentRoot, $requestMethod); //this can be faked by the client. not to be trusted. $this->is_ajax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; + + // is this an access point login? + if ($_SERVER['SERVER_ADDR']=="192.168.42.1") { + $this->is_ap = true; + } } /** diff --git a/version.json b/version.json index a60362ff3..c684e190f 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "name" : "Emoncms Core", - "version" : "11.4.9", + "version" : "11.4.10", "location" : "/var/www", "branches_available": ["stable","master"] }