Browse Source

Cleanups, title now correct

Stefan Ostermann 8 years ago
parent
commit
62ab48a917

+ 4 - 1
.gitignore

@@ -1,2 +1,5 @@
 .vagrant/
-
+.buildpath
+.project
+.settings/
+sites/html/index.html

+ 2 - 13
manifests/default.pp

@@ -73,9 +73,6 @@ class php{
     ensure => present,
   }
 
-  package { "php5-imagick":
-    ensure => present,
-  }
 
   package { "php5-mcrypt":
     ensure => present,
@@ -93,20 +90,11 @@ class php{
     ensure => present,
   }
 
-  package { "php5-sqlite":
-    ensure => present,
-  }
 
   package { "libapache2-mod-php5":
     ensure => present,
   }
   
-  exec { "reload_apache":
-    command => "/etc/init.d/apache2 reload",
-  }
-  
-
-
 }
 
 class mysql{
@@ -130,5 +118,6 @@ class mysql{
 include base
 include apache
 include php
-include mysql
+# We don't need mysql right now:
+# include mysql
 

+ 8 - 6
sites/html/htadmin/adminpwd.php

@@ -1,12 +1,8 @@
 <?php
 include_once ('includes/checklogin.php');
-include_once('tools/util.php');
-$ini = read_config();
 include_once ('includes/head.php');
-
-//$salt = $ini['admin_pwd_salt'];
-include_once ('tools/htpasswd.php');
 include_once ('includes/nav.php');
+include_once ('tools/htpasswd.php');
 
 ?>
 
@@ -20,7 +16,7 @@ include_once ('includes/nav.php');
 				?>
 					<div class="alert alert-info">
 					<?php
-					echo "<p>Your new hash: " . htpasswd::htcrypt($_POST['pwd']) . "</p>";
+					echo "<p>Your new hash: <code>" . htpasswd::htcrypt($_POST['pwd']) . "</code></p>";
 					?>
 						</div>
 				    <?php
@@ -41,6 +37,12 @@ include_once ('includes/nav.php');
 			
 		</div>
 	</div>
+		<div class=row>
+	<br/><br/>
+		<div class="col-xs-12 col-md-10 well">
+			<p>Use this generated hash in <code>config/config.ini</code> for the <code>admin_pwd_hash</code> key.</p>
+		</div>
+	</div>
 </div>
 
 <?php

+ 8 - 6
sites/html/htadmin/config/config.ini

@@ -1,11 +1,13 @@
-# important: secure this file from access!
+# HTAdmin config file.
+# Important: secure this file from access!
 [application]
+# Change this to customize your title:
+app_title = HTAdmin
 
-app_title = Basic Auth Tool
-
-# path to html files which have to be secured: 
+# Path to html files which have to be secured: 
 secure_path  = ../test/
-# default password = admin
+
+# Default password = admin
+# Change this for live!
 admin_user = admin
 admin_pwd_hash = VPZ23KZUsquyk
-

+ 3 - 0
sites/html/htadmin/includes/checklogin.php

@@ -1,4 +1,7 @@
 <?php
+/**
+ * Redirects to the login page if not logged in.
+ */
 session_start();
 include_once("tools/util.php");
 if (!check_login()) {

+ 7 - 1
sites/html/htadmin/includes/head.php

@@ -1,3 +1,9 @@
+<?php 
+include_once ('tools/util.php');
+if (!isset($ini)) {
+	$ini = read_config ();
+}
+?>
 <html>
 <head>
 <!-- Latest compiled and minified CSS -->
@@ -12,7 +18,7 @@
 <script src="script/script.js"></script>
 <link rel="stylesheet" href="styles/style.css">
 <meta name="viewport" content="width=device-width, initial-scale=1">
-<title>Password Generator</title>
+<title><?php echo $ini ['app_title']; ?></title>
 </head>
 <body>
 

+ 1 - 3
sites/html/htadmin/index.php

@@ -1,9 +1,7 @@
 <?php
 include_once ('includes/checklogin.php');
-include_once ('includes/head.php');
 include_once ('tools/htpasswd.php');
-include_once ('tools/util.php');
-$ini = read_config ();
+include_once ('includes/head.php');
 include_once ('includes/nav.php');
 
 $htpasswd = new htpasswd ( $ini ['secure_path'] . ".htpasswd" ); // path to your .htpasswd file

+ 1 - 2
sites/html/htadmin/logout.php

@@ -1,9 +1,8 @@
 <?php
 session_start();
 include_once ('includes/head.php');
-include_once('tools/util.php');
-$ini = read_config();
 $_SESSION ['login'] = false;
+
 include_once ('includes/nav.php');
 ?>
 

+ 1 - 3
sites/html/htadmin/selfservice.php

@@ -1,8 +1,6 @@
 <?php
-include_once ('includes/head.php');
 include_once ('tools/htpasswd.php');
-include_once ('tools/util.php');
-$ini = read_config ();
+include_once ('includes/head.php');
 include_once ('includes/nav.php');
 
 $htpasswd = new htpasswd ( $ini ['secure_path'] . ".htpasswd" );

+ 1 - 1
sites/html/htadmin/tools/util.php

@@ -21,7 +21,7 @@ function check_username($username) {
 	if (!isset($username)||strlen($username)>20 || strlen($username)<3) {
 		return false;
 	}
-	return preg_match('/^[a-zA-Z0-9@\.]+$/', $username);
+	return preg_match('/^[a-zA-Z0-9]+$/', $username);
 
 }
 

+ 0 - 2
sites/html/test/.htpasswd

@@ -1,2 +0,0 @@
-test:YBKUDV6fZ9/yE
-superuser:WXVCezoX2Ccg.