No minimum password length, and say how to reset it

The script refused anything under ten characters. That is a policy the owner
should hold, not one the tooling invents; the only rule left is that the password
cannot be empty, since an empty one would let anyone in. Resetting is the same
script with --force, which overwrites the hash and generates a fresh session
secret, signing out anyone who was signed in - now written down in the operating
notes and the deployment readme, including the form that prompts on your own
machine instead of the server.
This commit is contained in:
tanshu committed 2026-09-23 00:02:35 +05:30
1 parent b178e00ebf
commit 11f60c619f
3 files changed
+42 -11

No files matched your search

+40 -6
View File
@@ -25,11 +25,28 @@ Preview to check it, then Publish. Publishing archives whatever was current.
**Put an older menu back.** Open the Section's "older menus" fold in the admin,
open the set you want and press "Make current". Its URL does not change.
**Change the admin password.** On the server:
**Change or reset the admin password.** Run the provision script again with
`--force`: it overwrites the password hash, and generates a fresh session secret,
which signs out anyone who was signed in. Nothing else changes.
```sh
bash /tmp/provision-site-env.sh /var/lib/menu.hopsngrains.com --force
docker restart menu-app.hopsngrains.com
ssh -t monoco bash /tmp/provision-site-env.sh /var/lib/menu.hopsngrains.com --force
ssh monoco docker restart menu-app.hopsngrains.com
```
There is no minimum length and no password policy — the one rule is that the
password cannot be empty. It can also be set from a machine that has this repo
checked out, with the prompt on that machine rather than the server:
```sh
cd ~/programming/static-menu/menu-admin
read -r -s -p 'Admin password: ' PW; echo
HASH=$(printf '%s' "$PW" | node -e "let s='';process.stdin.setEncoding('utf8');process.stdin.on('data',c=>s+=c).on('end',async()=>{const m=await import('./src/auth.ts');process.stdout.write(await m.hashPassword(s))})")
SECRET=$(node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('base64url'))")
printf 'ADMIN_PASSWORD_HASH=%s
SESSION_SECRET=%s
' "$HASH" "$SECRET" | ssh monoco "docker run --rm -i --user 1000:1000 -v /var/lib/menu.hopsngrains.com:/data --entrypoint sh registry.tanshu.com/menu-admin:2026-09-22 -c 'umask 077 && cat > /data/site.env'"
ssh monoco docker restart menu-app.hopsngrains.com
```
**Add, rename, reorder or remove a category.** In the admin, open the
@@ -123,11 +140,28 @@ Preview to check it, then Publish. Publishing archives whatever was current.
**Put an older menu back.** Open the Section's "older menus" fold in the admin,
open the set you want and press "Make current". Its URL does not change.
**Change the admin password.** On the server:
**Change or reset the admin password.** Run the provision script again with
`--force`: it overwrites the password hash, and generates a fresh session secret,
which signs out anyone who was signed in. Nothing else changes.
```sh
bash /tmp/provision-site-env.sh /var/lib/menu.hopsngrains.com --force
docker restart menu-app.hopsngrains.com
ssh -t monoco bash /tmp/provision-site-env.sh /var/lib/menu.hopsngrains.com --force
ssh monoco docker restart menu-app.hopsngrains.com
```
There is no minimum length and no password policy — the one rule is that the
password cannot be empty. It can also be set from a machine that has this repo
checked out, with the prompt on that machine rather than the server:
```sh
cd ~/programming/static-menu/menu-admin
read -r -s -p 'Admin password: ' PW; echo
HASH=$(printf '%s' "$PW" | node -e "let s='';process.stdin.setEncoding('utf8');process.stdin.on('data',c=>s+=c).on('end',async()=>{const m=await import('./src/auth.ts');process.stdout.write(await m.hashPassword(s))})")
SECRET=$(node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('base64url'))")
printf 'ADMIN_PASSWORD_HASH=%s
SESSION_SECRET=%s
' "$HASH" "$SECRET" | ssh monoco "docker run --rm -i --user 1000:1000 -v /var/lib/menu.hopsngrains.com:/data --entrypoint sh registry.tanshu.com/menu-admin:2026-09-22 -c 'umask 077 && cat > /data/site.env'"
ssh monoco docker restart menu-app.hopsngrains.com
```
**Add, rename, reorder or remove a category.** In the admin, open the