Validate setup password

This commit is contained in:
kaetemi 2014-09-05 11:21:21 +02:00
parent daf80ea104
commit b273806cf0
3 changed files with 36 additions and 4 deletions

View file

@ -9,24 +9,34 @@ try {
$pageTitle = "Authenticate"; $pageTitle = "Authenticate";
include('header.php'); include('header.php');
require_once('config.php');
?> ?>
<div style="margin-left: auto; margin-right: auto; max-width: 512px;"> <div style="margin-left: auto; margin-right: auto; max-width: 512px;">
<?php /*var_dump($_POST);*/ if ($_POST) { ?> <?php /*var_dump($_POST);*/ $showForm = true; if ($_POST) { ?>
<?php if ($_POST['nelSetupPassword'] == $NEL_SETUP_PASSWORD) { ?>
<?php <?php
// TODO
$_SESSION['nelSetupAuthenticated'] = 1; $_SESSION['nelSetupAuthenticated'] = 1;
printalert("success", "You are now authenticated"); printalert("success", "You are now authenticated");
$showForm = false;
?> ?>
<p> <p>
<a class="btn btn-primary" href="index.php">Continue</a> <a class="btn btn-primary" href="index.php">Continue</a>
</p> </p>
<?php } else { ?> <?php } else {
printalert("danger", "Invalid password");
} ?>
<?php } if ($showForm) { ?>
<form class="form" role="form" method="POST" action="" enctype="application/x-www-form-urlencoded"> <form class="form" role="form" method="POST" action="" enctype="application/x-www-form-urlencoded">
<div class="input-group"> <div class="input-group">

View file

@ -102,6 +102,15 @@ function upgrade_support_databases($continue_r) {
function upgrade_domain_databases($continue_r) { function upgrade_domain_databases($continue_r) {
$continue = $continue_r; $continue = $continue_r;
$con = null;
$con = connect_database($continue, "ring");
$continue = ($con != null);
if ($continue && get_db_version("ring") < 1) {
$continue = update_database_structure($continue, $con, "ring_domain_00001.sql");
$continue = set_db_version($continue, "ring", 1);
}
disconnect_database($con, "ring");
return $continue; return $continue;
} }

View file

@ -80,6 +80,11 @@ include('header.php');
$continue = create_use_database($continue, $con, $_POST["toolDatabase"]); $continue = create_use_database($continue, $con, $_POST["toolDatabase"]);
} }
if ($roleDomain) {
// Create Ring database
$continue = create_use_database($continue, $con, $_POST["domainDatabase"]);
}
if ($con) { if ($con) {
mysqli_close($con); mysqli_close($con);
printalert("info", "Disconnected from the Service SQL server"); printalert("info", "Disconnected from the Service SQL server");
@ -167,6 +172,10 @@ include('header.php');
$continue = upgrade_domain_databases($continue); $continue = upgrade_domain_databases($continue);
} }
if ($roleService) {
// TODO: Create the default admin user
}
if ($roleSupport) { if ($roleSupport) {
// Load AMS Library // Load AMS Library
if ($continue) { if ($continue) {
@ -200,6 +209,10 @@ include('header.php');
} }
} }
if ($roleDomain) {
// TODO: Register the domain with the nel database etc
}
if ($continue && $roleService) { if ($continue && $roleService) {
if (file_put_contents("role_service", "1")) { if (file_put_contents("role_service", "1")) {
printalert("success", "Service role successfully installed"); printalert("success", "Service role successfully installed");
@ -423,7 +436,7 @@ include('header.php');
</div> </div>
<div id="panelDomain" class="panel panel-default hide"> <div id="panelDomain" class="panel panel-default hide">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Domain</h2> <h2 class="panel-title">Domain <small>(Multiple domains require separate installations, as they may run different versions)</small></h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="form-group"> <div class="form-group">