Commit 7c8291f0 authored by William Paul Liggett's avatar William Paul Liggett

Made the admin page a bit prettier.

parent 3ede127b
......@@ -13,9 +13,13 @@
<body>
<h1>OpenVigilance Task: Admin Page</h1>
<?php
// Displays if any login errors were detected.
$error_msg = "&nbsp;"; // No error = Non-breaking space character.
// Used to display an HTML login form on first load or if the username and password was incorrect.
// Note: The tab whitespace is back slightly to make the HTML source pretty.
$login_form = '
<form action="admin" name="AdminLogon" method="post">
<form action="admin" name="AdminLogin" method="post">
<label for="username">Username:</label>
<input type="text" name="username" id="username" />
<br />
......@@ -30,8 +34,6 @@
// Sets the `$ov_admin_username' and the `$ov_admin_password_hash' variables.
require_once "../../../../protected_site_configs/junktext.com/openvigilance_admin_account.php";
$error_msg = "";
$submitted_username = htmlspecialchars($_POST['username']);
$submitted_password = htmlspecialchars($_POST['password']);
......@@ -45,7 +47,7 @@
}
// Checks to see whether to re-display the login <form>.
if($error_msg) {
if($error_msg !== "&nbsp;") {
echo "<p class='error_msg'>$error_msg</p>";
echo $login_form;
}
......@@ -60,6 +62,8 @@
// GET: The page upon first load, before the <form> has been submitted.
else {
// Displays the HTML login <form>.
// There should be no error on first load, but this keeps the form layout in the same position.
echo "<p class='error_msg'>$error_msg</p>";
echo $login_form;
}
?>
......
......@@ -77,15 +77,24 @@ h1 {
label {
width: 5rem;
margin-right: 1.5rem;
margin-bottom: 0.2rem;
float: left;
display: inline-block;
}
input[type = "text"], input[type = "password"] {
width: 8rem;
margin-bottom: 0.2rem;
display: inline-block;
}
.error_msg {
font-weight: bold;
text-align: center;
color: red;
}
form[name = "AdminLogin"] {
margin: auto;
display: block;
width: 16rem;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment