Make the login page much prettier
This commit is contained in:
parent
d7baf055ac
commit
8c565f1d2d
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,8 +5,8 @@
|
|||||||
/book
|
/book
|
||||||
|
|
||||||
|
|
||||||
/static/light.css
|
/static/main.css
|
||||||
/static/dark.css
|
/static/main.css.map
|
||||||
|
|
||||||
# Devenv
|
# Devenv
|
||||||
.devenv*
|
.devenv*
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
# Snapshot testing
|
# Snapshot testing
|
||||||
pkgs.cargo-insta
|
pkgs.cargo-insta
|
||||||
|
|
||||||
pkgs.grass-sass
|
# pkgs.grass-sass not compatible, c.f. https://github.com/connorskees/grass/issues/105
|
||||||
|
pkgs.dart-sass
|
||||||
|
|
||||||
pkgs.entr
|
pkgs.entr
|
||||||
|
|
||||||
pkgs.mdbook
|
pkgs.mdbook
|
||||||
|
5
sample/generate_keypair.sh
Executable file
5
sample/generate_keypair.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
openssl genrsa -out keypair.pem 4096
|
52
sample/keypair.pem
Normal file
52
sample/keypair.pem
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQC2b8ZOyi19fdt6
|
||||||
|
PcwbVk9bCnX8mnXctS1uOuCkmK/hfi+xUgX8kU35XaT0jdY4R1o45J6olLSHqqhc
|
||||||
|
VFc0XRj32kxYDIhYChuMoocN26ptOep2/ODM1WTmuaoij0PkoM6NEB56IC9hiycJ
|
||||||
|
3UQ4czcP+KG8jvAGwlJSR469b3Y80I/L8R0LJdwZjATZbxiex3gsrMJWXvJkl+XM
|
||||||
|
VBpDx0/3Rp1C7iJo90BNz92D2Zt5vAjnxm6igPhA1ZFqhR7qjU8Y+ztdXPZ3+9T4
|
||||||
|
41258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ygZRXTLCUEsDBG0wZRObqwDHneHGTQ==
|
||||||
|
-----END PRIVATE KEY-----
|
5
sample/run.sh
Executable file
5
sample/run.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
HORNBEAM_BASE=.. exec cargo run -- --config "config.toml" --secrets "secrets.toml" serve
|
@ -3,6 +3,13 @@ set -eu
|
|||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
# what sass CLI to use
|
||||||
|
# grass is currently incompatible: https://github.com/connorskees/grass/issues/105
|
||||||
|
# so we use dart-sass
|
||||||
|
SASS_IMPL=${SASS_IMPL:-dart-sass}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
find ./src_scss | entr -d bash -c 'for theme in "dark" "light"; do grass --style compressed src_scss/$theme.scss static/$theme.css; done'
|
# find ./src_scss | entr -d bash -c 'for theme in "dark" "light"; do grass --style compressed src_scss/$theme.scss static/$theme.css; done'
|
||||||
|
|
||||||
|
find ./src_scss | entr -d $SASS_IMPL -I deps/picocss/scss --style compressed src_scss/main.scss static/main.css; done
|
||||||
done
|
done
|
||||||
|
15
src_scss/_centred.scss
Normal file
15
src_scss/_centred.scss
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
body.centred {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.centred * {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 95vw;
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
max-width: min(80vw, 1280px);
|
||||||
|
}
|
||||||
|
}
|
56
src_scss/main.scss
Normal file
56
src_scss/main.scss
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
@use "pico" with (
|
||||||
|
$theme-color: "pumpkin",
|
||||||
|
|
||||||
|
// Consider which modules and things we actually want enabled.
|
||||||
|
$enable-semantic-container: true,
|
||||||
|
$enable-classes: false,
|
||||||
|
$modules: (
|
||||||
|
// Theme
|
||||||
|
"themes/default": true,
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
"layout/document": true,
|
||||||
|
"layout/landmarks": true,
|
||||||
|
"layout/container": true,
|
||||||
|
"layout/section": true,
|
||||||
|
"layout/grid": true,
|
||||||
|
"layout/overflow-auto": true,
|
||||||
|
|
||||||
|
// Content
|
||||||
|
"content/link": true,
|
||||||
|
"content/typography": true,
|
||||||
|
"content/embedded": false,
|
||||||
|
"content/button": true,
|
||||||
|
"content/table": true,
|
||||||
|
"content/code": false,
|
||||||
|
"content/figure": false,
|
||||||
|
"content/misc": true,
|
||||||
|
|
||||||
|
// Forms
|
||||||
|
"forms/basics": true,
|
||||||
|
"forms/checkbox-radio-switch": false,
|
||||||
|
"forms/input-color": false,
|
||||||
|
"forms/input-date": false,
|
||||||
|
"forms/input-file": false,
|
||||||
|
"forms/input-range": false,
|
||||||
|
"forms/input-search": false,
|
||||||
|
|
||||||
|
// Components
|
||||||
|
"components/accordion": false,
|
||||||
|
"components/card": false,
|
||||||
|
"components/dropdown": false,
|
||||||
|
"components/group": false,
|
||||||
|
"components/loading": false,
|
||||||
|
"components/modal": false,
|
||||||
|
"components/nav": false,
|
||||||
|
"components/progress": false,
|
||||||
|
"components/tooltip": false,
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
"utilities/accessibility": true,
|
||||||
|
"utilities/reduce-motion": true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@use "_centred.scss";
|
@ -1,11 +1,23 @@
|
|||||||
html
|
declare
|
||||||
|
// = false
|
||||||
|
param $centred = 0 > 1
|
||||||
|
|
||||||
|
html {lang="en"}
|
||||||
head
|
head
|
||||||
meta {charset="UTF-8"}
|
meta {charset="UTF-8"}
|
||||||
|
|
||||||
|
meta {name="viewport", content="width=device-width, initial-scale=1"}
|
||||||
|
|
||||||
|
meta {name="color-scheme", content="light dark"}
|
||||||
|
|
||||||
title
|
title
|
||||||
optional slot :title
|
optional slot :title
|
||||||
|
|
||||||
link {rel="stylesheet", href="/statics/light.css"} // TODO support theming
|
link {rel="stylesheet", href="/static/main.css"}
|
||||||
|
|
||||||
body
|
if $centred
|
||||||
slot :main
|
body.centred
|
||||||
|
slot :main
|
||||||
|
else
|
||||||
|
body
|
||||||
|
slot :main
|
||||||
|
@ -35,3 +35,12 @@ for $validator in $form.info.field_validators($name)
|
|||||||
|
|
||||||
|
|
||||||
input {$type, $name, $minlength?, $maxlength?, $required?, $pattern?}
|
input {$type, $name, $minlength?, $maxlength?, $required?, $pattern?}
|
||||||
|
|
||||||
|
set $errs = $form.errors.__get($name)
|
||||||
|
if $errs.len() != 0
|
||||||
|
@form_errors{count = $errs.len()}
|
||||||
|
|
||||||
|
ul
|
||||||
|
for $err in $errs
|
||||||
|
li
|
||||||
|
"${$err.error_code()}"
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
BarePage
|
BarePage {centred = 1 > 0}
|
||||||
form {method = "POST"}
|
form {method = "POST"}
|
||||||
"UN"
|
set $errs = $form.errors.form_wide
|
||||||
Text {$form, name = "username"}
|
if $errs.len() != 0
|
||||||
" PW"
|
@form_errors{count = $errs.len()}
|
||||||
Text {$form, name = "password", type = "password"}
|
|
||||||
" "
|
ul
|
||||||
|
for $err in $errs
|
||||||
|
li
|
||||||
|
@login_error{errcode = $err.error_code()}
|
||||||
|
fieldset
|
||||||
|
label
|
||||||
|
@form_username
|
||||||
|
Text {$form, name = "username"}
|
||||||
|
|
||||||
|
label
|
||||||
|
@form_password
|
||||||
|
Text {$form, name = "password", type = "password"}
|
||||||
|
|
||||||
input {type = "hidden", name = "xsrf", value = $xsrf_token}
|
input {type = "hidden", name = "xsrf", value = $xsrf_token}
|
||||||
button {type = "submit"}
|
button {type = "submit"}
|
||||||
"click here to login"
|
@form_login
|
||||||
" (temporary form)"
|
|
||||||
|
17
translations/en/login.ftl
Normal file
17
translations/en/login.ftl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
form_errors = There {$count ->
|
||||||
|
[one] was an error
|
||||||
|
*[other] were {$count} errors
|
||||||
|
}:
|
||||||
|
|
||||||
|
form_login = Log in
|
||||||
|
|
||||||
|
form_username = Username
|
||||||
|
|
||||||
|
form_password = Password
|
||||||
|
|
||||||
|
login_error = {$errcode ->
|
||||||
|
[invalid_credentials] The wrong username and/or password were provided.
|
||||||
|
|
||||||
|
*[other] $errcode
|
||||||
|
}
|
17
translations/fr/login.ftl
Normal file
17
translations/fr/login.ftl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
form_errors = Il y a eu {$count ->
|
||||||
|
[one] une erreur
|
||||||
|
*[other] {$count} erreurs
|
||||||
|
}:
|
||||||
|
|
||||||
|
form_login = Se connecter
|
||||||
|
|
||||||
|
form_username = Nom d'utilisateur
|
||||||
|
|
||||||
|
form_password = Mot de passe
|
||||||
|
|
||||||
|
login_error = {$errcode ->
|
||||||
|
[invalid_credentials] Les credentiales sont mauvaises. (?TODO)
|
||||||
|
|
||||||
|
*[other] {$errcode}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user