Add login screen

This commit is contained in:
Josh Holtrop 2026-03-27 18:36:13 -04:00
commit 09c764034e
2 changed files with 151 additions and 0 deletions

137
assets/login.erb Normal file
View File

@ -0,0 +1,137 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Server Status</title>
<style>
body {
background: #0f1117;
color: #e2e8f0;
font-family: 'Segoe UI', system-ui, sans-serif;
min-height: 100vh;
margin: 0;
padding: 2rem;
display: flex;
flex-direction: column;
align-items: center;
}
header {
width: 100%;
max-width: 400px;
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #1e2433;
}
header h1 {
font-size: 1.4rem;
font-weight: 600;
letter-spacing: 0.05em;
color: #94a3b8;
text-transform: uppercase;
}
header h1 span { color: #e2e8f0; }
.card {
background: #161b27;
border-radius: 12px;
padding: 2rem;
border: 1px solid #1e2433;
width: 100%;
max-width: 400px;
box-sizing: border-box;
}
.card-title {
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #94a3b8;
margin-bottom: 1.5rem;
text-align: center;
}
.form-group {
margin-bottom: 1rem;
}
label {
display: block;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: #475569;
margin-bottom: 0.4rem;
}
input[type="text"],
input[type="password"] {
width: 100%;
box-sizing: border-box;
padding: 0.6rem 0.8rem;
background: #0f1117;
border: 1px solid #1e2433;
border-radius: 7px;
color: #e2e8f0;
font-family: inherit;
font-size: 0.9rem;
outline: none;
transition: border-color 0.2s;
}
input[type="text"]:focus,
input[type="password"]:focus {
border-color: #4ade80;
}
button {
width: 100%;
padding: 0.65rem;
margin-top: 0.5rem;
background: #14532d;
color: #4ade80;
border: none;
border-radius: 7px;
font-family: inherit;
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
cursor: pointer;
transition: background 0.2s;
}
button:hover {
background: #166534;
}
</style>
</head>
<body>
<header>
<h1><span>homelab</span> &middot; status</h1>
</header>
<div class="card">
<div class="card-title">Sign In</div>
<form method="post">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" autocomplete="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" autocomplete="current-password" required>
</div>
<button type="submit">Log In</button>
</form>
</div>
</body>
</html>

14
malp.rb Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require "cgi"
require "erb"
ASSETS_DIR = File.join(__dir__, "assets")
cgi = CGI.new
template = ERB.new(File.read(File.join(ASSETS_DIR, "login.erb")))
cgi.out("type" => "text/html", "charset" => "UTF-8") do
template.result(binding)
end