Three complaints, one cause. Logging out could not finish because the session belonged to another server, whose logout is POST-only and unreachable from here. "Ese usuario ya está en uso" for somebody absent from Miembros, because erase_member deleted our row and left the git account standing — two stores of users, one of them showing. And the hand-off to a differently-designed domain, with a Forgot password that could never work. All three followed from delegating identity, so it is no longer delegated. Members now sign in at /comunidad/login against a scrypt hash in our own database, via werkzeug.security, which arrives with Flask. They have no account on the git server at all, which makes the collision impossible rather than fixed. Logout is one click. This removes more than it adds: the OAuth round trip, the client registration, tokens.py with its refresh-before-expiry logic, the gitea_tokens table, and the logged-out page that existed to apologise for a logout that did not log you out. The editor keeps per-writer attribution without per-writer tokens: one CONTENT_TOKEN commits, and each commit names its author, which Gitea's contents API supports and a test now asserts. CONTENT_TOKEN falls back to GITEA_ADMIN_TOKEN so nothing breaks on deploy, but it only needs write access to one repository, while the admin token can modify every account on the instance — and now has no remaining job. The refusals are the interesting part. Unknown name, wrong password, suspended member and invited-but-never-arrived all answer identically, asserted by comparing the rendered bytes. The hash check runs against a decoy even when there is no such member, so an unknown name does not answer faster. Attempts are rate limited, counted inside SQLite for the reason invites.py documents. A NULL hash never matches anything. Migration 2 adds password_hash and drops the dead OAuth tokens. Everyone starts NULL, including the owner, so scripts/set-password.sh exists and was tested before this could ship: it prompts without echo, never takes the password as an argument where ps would show it, and refuses a short one or an unknown member. Rehearsed against a rebuilt copy of the server's database: starts, keeps the photo, drops the tokens table, serves a login form with no redirect, signs in, signs out, stays out. 223 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
59 lines
2.5 KiB
YAML
59 lines
2.5 KiB
YAML
# Members area — Flask + SQLite behind Caddy.
|
|
#
|
|
# Copy this directory to /srv/board/ on the server, fill in .env, then:
|
|
# mkdir -p /srv/board/data && sudo chown 1000:1000 /srv/board/data
|
|
# docker compose up -d
|
|
#
|
|
# Bound to localhost like Gitea and Woodpecker: the only way in from outside is
|
|
# through Caddy, which terminates TLS and forwards /comunidad/.
|
|
|
|
services:
|
|
board:
|
|
image: vienalatina/board:1
|
|
restart: unless-stopped
|
|
environment:
|
|
# Session signing key. Generate once with `openssl rand -hex 32`.
|
|
# Changing it signs everyone out; losing it means nothing worse.
|
|
- BOARD_SECRET_KEY=${BOARD_SECRET_KEY}
|
|
|
|
# Where the site's content lives. Members never see it: they sign in
|
|
# here, against a password in our own database.
|
|
- GITEA_URL=https://git.vienalatina.com
|
|
- BOARD_BASE_URL=https://vienalatina.com
|
|
|
|
# The Gitea username that becomes the one owner, applied once on an empty
|
|
# database. Changing it later does nothing: ownership moves from inside
|
|
# the app, so nobody can take it by editing this file.
|
|
- BOARD_OWNER=${BOARD_OWNER}
|
|
|
|
# Site-admin token, used only to create Gitea accounts for new members.
|
|
# This is the most privileged secret on the box after Gitea's own
|
|
# database: anything that can read this environment can create accounts.
|
|
# Leave it empty to run without account creation — admins then add people
|
|
# who already have a Gitea login, and everything else still works.
|
|
- GITEA_ADMIN_TOKEN=${GITEA_ADMIN_TOKEN:-}
|
|
- CONTENT_TOKEN=${CONTENT_TOKEN:-}
|
|
|
|
- BOARD_DB=/data/board.db
|
|
|
|
# Outgoing mail, for invitations and password resets. Empty MAIL_HOST is
|
|
# a supported state: the members area still works, but nobody can be
|
|
# invited or recover a password, and the screens say so.
|
|
#
|
|
# Every one of these has to be listed here. Compose does not hand the
|
|
# contents of .env to the container by itself — it only substitutes into
|
|
# this file — so a variable added to .env and not added here is read by
|
|
# nobody, and the app reports mail as unconfigured with the settings
|
|
# sitting right there on disk.
|
|
- MAIL_HOST=${MAIL_HOST:-}
|
|
- MAIL_PORT=${MAIL_PORT:-587}
|
|
- MAIL_SECURITY=${MAIL_SECURITY:-starttls}
|
|
- MAIL_USER=${MAIL_USER:-}
|
|
- MAIL_PASSWORD=${MAIL_PASSWORD:-}
|
|
- "MAIL_FROM=${MAIL_FROM:-Viena Latina <hola@vienalatina.com>}"
|
|
|
|
volumes:
|
|
- ./data:/data
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|