Skip to content

Commit

Permalink
special setup route for use on emonpi/emonbase
Browse files Browse the repository at this point in the history
  • Loading branch information
Trystan Lea committed Jun 15, 2017
1 parent 5ca1093 commit 272495e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Modules/user/login_block.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
}
</style>
<script type="text/javascript" src="<?php echo $path; ?>Modules/user/user.js"></script>

<br>
<div class="main">
<div class="well">
<img src="<?php echo $path; ?>Theme/<?php echo $theme; ?>/emoncms_logo.png" alt="Emoncms" width="256" height="46" />
<div class="login-container">
<form id="login-form" method="post">
<form id="login-form" method="post" action="/">
<div id="loginblock">
<div class="form-group register-item" style="display:none">
<label><?php echo _('Email'); ?>
Expand Down Expand Up @@ -105,6 +105,7 @@

var path = "<?php echo $path; ?>";
var register_open = false;
$("body").css("background-color","#1d8dbc");

$(document).ready(function() {
var passwordreset = "<?php echo $enable_password_reset; ?>";
Expand Down
20 changes: 18 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,30 @@
// 5) Get route and load controller
$route = new Route(get('q'), server('DOCUMENT_ROOT'), server('REQUEST_METHOD'));

// Special routes

// Return brief device descriptor for hub detection
if ($route->controller=="describe") { header('Content-Type: text'); echo "emonbase"; die; }

if (get('embed')==1) $embed = 1; else $embed = 0;

// If no route specified use defaults
if ($route->isRouteNotDefined())
{
// EmonPi Setup Wizard
if ($allow_emonpi_admin) {
if (file_exists("Modules/setup")) {
require "Modules/setup/setup_model.php";
$setup = new Setup($mysqli);
if ($setup->status()=="unconfigured") {
$default_controller = "setup";
$default_action = "";
// Provide special setup access to WIFI module functions
$_SESSION['setup_access'] = true;
}
}
}

if (!isset($session['read']) || (isset($session['read']) && !$session['read'])) {
// Non authenticated defaults
$route->controller = $default_controller;
Expand Down

0 comments on commit 272495e

Please sign in to comment.