Files
plainleaf/web/auth.html
T
+1 766fb96ff2 Adding support for hosting with URL prefix (#1357)
* Adding support for hosting with URL prefix to make reverse-proxy setup on sub-path possible

* Adjusting recent changes to auth.html (changing to relative URLs)  after rebasing from upstream

* Adjusting service_worker and application manifest to support URL-prefix

* Add notes on Space Lua Pattern Matching (#1366)

* Remove common/space_lua/stdlib/math.md (#1371)

* Escape pipe symbol in string.gsub (#1370)

* feat: configure vim in CONFIG (#1369)

* Fix week calculation (#1368)

* Add more tests for week calculation

* Fix week calculation

* Add more tests

* Implement Lua built-in function os.difftime (#1367)

* Implement Lua built-in function os.difftime

* Test os.difftime

---------

Co-authored-by: Zef Hemel <zef@zef.me>

* Fix index page naming during server initialization (#1365)

* Allow non-zero shell exit codes (#1377)

* Generate version from git describe at build time (#1374)

* Generate version from git describe at build time

* Add 2.0-beta prefix

* Use Deno.Command instead of Deno.run

* Add missing case to math.random and check arguments (#1372)

* Fix paragraphs for the tag page (#1376)

* Render a predefined string for empty markdown table instead of pipe characters (#1387)

* Fix string.find (#1390)

* Fetch tags and history for proper version string generation (#1388)

* Fix support for disabling shortcuts (#1393)

* Add GitHub Actions Cache to reduce build times (#1394)

* Order strings in queries using collation algorithm (#1391)

Configurable with queryCollation, default value maintains old behaviour.
Added tests, schema, example settings, and documentation to query page.

Close: #614
Close: #1316

* Utility function to handle empty query results and templates (#1386)

* Add global Lua function 'some'

Moved documentation for 'each' function to non-standard section.

* Revert "Add optional argument to template.each for empty collection output (#1359)"

This reverts commit b73dadec67.

* Reimplement #1359 using 'some' function

* Update Lua to event.listEvents to match plugos syscall (#1397)

The documentation, example, and other function names use
`event.listEvents`, but `event.list` is being registered with the
client.

* Update widget header to not overflow container (#1410)

Also add a 10px margin below the header to maintain consistent spacing
around the widget contents.

* fix: case insensitive admonitions by default (#1409)

* fix: closing bracket is missing (#1408)

* Add optional priority attribute to PageCreatingContent (#1392)

* Add optional priority attribute to PageCreatingContent

* Minor simplification

* Fix comments

* Revert changes

* Add pageEventHandlers

* Use UTC year, month, and date for strings lacking time components (#1403)

* feat: allow CONFIG.md in any directory (#1398)

* fix: bundle external dependencies (#1379)

* Deno bump

* Copy-edit splash screen text (#1413)

* Fixes #1401 by implementing Lua's select

* Fixes offline capability of PWA (I hope).

Now storing config in localStorage.

* fix lint

* Reduce blast radius of Lua errors

* Fixes #1411: adds 'priority' setting for space style

* Refactor: Merging common/ into web/

* Fixes #1400

* Improves #1312 by rendering Lua expressions (but not widgets)

* Fix minor typos, add configuration to the docs

---------

Co-authored-by: wbhouston <wmbhouston@gmail.com>
Co-authored-by: Lennart Ochel <lennart.ochel@outlook.com>
Co-authored-by: Matthias Benaets <89214559+MatthiasBenaets@users.noreply.github.com>
Co-authored-by: Zef Hemel <zef@zef.me>
Co-authored-by: Marek S. Łukasiewicz <marek@lukasiewicz.tech>
Co-authored-by: Ivan Alejandro <ivanalejandro0@gmail.com>
Co-authored-by: Albert-Jan de Vries <aj+github@albert-jandevries.nl>
Co-authored-by: Cole Stowell <121599022+costowell@users.noreply.github.com>
Co-authored-by: Jim Tittsler <jimt@onjapan.net>
2025-06-04 15:15:14 +02:00

224 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<base href="{{HOST_URL_PREFIX}}/" />
<link rel="icon" type="image/x-icon" href="favicon.png" />
<title>Login to SilverBullet</title>
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
html {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
"Helvetica Neue",
Arial,
"Noto Sans",
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji";
--primary-button-color: #eee;
--primary-button-background-color: #464cfc;
--primary-button-hover-background-color: color-mix(in srgb,
var(--primary-button-background-color),
black 35%);
--primary-button-border-color: transparent;
--modal-border-color: #6c6c6c;
--top-color: #66A3BB;
--bottom-color: #0B3A69;
background: linear-gradient(var(--top-color), var(--bottom-color));
}
header {
position: absolute;
padding: 1rem;
font-size: 1.2rem;
}
footer {
text-align: center;
}
h1 {
font-size: 1.5rem;
font-weight: normal;
}
input {
font-family: inherit;
font-size: inherit;
padding: 0.5em;
}
form>div {
display: flex;
flex-direction: column;
flex-grow: 1;
}
button {
background: var(--primary-button-background-color);
color: var(--primary-button-color);
box-shadow: 0 0 0.2em rgba(0, 0, 0, 0.05);
border: 1px solid var(--border-color);
padding: 0.7em;
border-radius: 0.5em;
&:hover {
background-color: var(--primary-button-hover-background-color);
}
&:focus {
outline: 2px solid var(--primary-button-color);
outline-offset: -3px;
}
}
.floating-island {
padding: 3em;
border-radius: 8px;
box-shadow: rgba(0, 0, 0, 0.35) 0px 20px 20px;
background-color: white;
border: var(--modal-border-color) 1px solid;
}
.error-message {
color: red;
}
.center {
height: 100vh;
display: grid;
place-items: center;
}
.flow {
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.flow>* {
margin-block: 0;
}
.flow>*+* {
margin-block-start: var(--space, 1rem);
}
/* Add styles for checkbox alignment */
.checkbox-wrapper {
display: flex;
align-items: center;
gap: 0.5rem;
flex-direction: row;
}
.checkbox-wrapper input[type="checkbox"] {
margin: 0;
}
</style>
</head>
<body>
<div class="center">
<div class="flow floating-island">
<h1>
Login to <img src=".client/logo.png" style="height: 1ch" />
SilverBullet
</h1>
<form action=".auth" method="POST" id="login" class="flow">
<div class="error-message"></div>
<div>
<label for="username">
Username
</label>
<input type="text" name="username" id="username" autocomplete="off" autocorrect="off" autocapitalize="off"
autofocus />
</div>
<div>
<label for="password">
Password
</label>
<input type="password" name="password" id="password" />
</div>
<div class="checkbox-wrapper">
<input type="checkbox" name="rememberMe" id="rememberMe" />
<label for="rememberMe">Remember me</label>
</div>
<div style="--space: 1.8rem">
<button>Login</button>
</div>
</form>
<footer>
<a href="https://silverbullet.md">What is SilverBullet?</a>
</footer>
</div>
</div>
<script>
const params = new URLSearchParams(window.location.search);
const error = params.get("error");
if (error === "0") {
document.querySelector(".error-message").innerText =
"The sent data was invalid";
} else if (error === "1") {
document.querySelector(".error-message").innerText =
"Invalid username or password";
} else if (error === "2") {
document.querySelector(".error-message").innerText =
"Too many invalid logins. Try again later";
}
const from = params.get("from");
if (from) {
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "from");
input.setAttribute("value", from);
document.getElementById("login").appendChild(input);
}
// Fetch the app name from the manifest file
fetch('.client/manifest.json')
.then(response => {
if (!response.ok) {
throw new Error('Failed to load manifest');
}
return response.json();
})
.then(manifest => {
const appName = manifest.name || 'SilverBullet';
// Update the title
document.title = `Login to ${appName}`;
// Update the header text
const header = document.querySelector('h1');
if (header) {
header.innerHTML = `Login to <img src=".client/logo.png" style="height: 1ch" /> ${appName}`;
}
})
.catch(error => {
console.error('Error fetching manifest:', error);
});
</script>
</body>
</html>