OpenFolia

Sign-in with email and password

The operator side of passwords: the setting, the first admin, invites and reset links, lockout and sessions.

People can sign in to the editor with their email address and a password. It is on by default (CCMS_PASSWORD_SIGN_IN, on or off), except in demo mode, where it is off and on is refused at start-up. It works beside OpenID Connect: the sign-in page then shows the form and the provider's button.

CCMS_PASSWORD_SIGN_IN and CCMS_INVITE_DAYS go into deploy/api.env: compose.yaml does not pass them on from deploy/.env.

The first admin

Either set CCMS_FIRST_ADMIN_EMAIL before the first start, as the quick start does, or run first-admin at any time:

docker compose exec api node dist/database/first-admin.main.js you@example.com \
  --name "Your Name" --editor https://docs.example.com/

It makes the user, and the role admin with every permission when it is missing, and prints a one-time link to choose a password. The link goes to your terminal, never to the log. It works once, for CCMS_INVITE_DAYS days (default 7). Running it again makes a new link, and the earlier one stops working. --editor is the editor's address as people open it (default: CCMS_PUBLIC_URL).

Everyone else

Admins add people in the editor (Users and roles). A new person gets an invite: a one-time link, shown once to copy, and emailed too when email is set up. An admin can make a new invite or a reset link at any time; the earlier link stops working. An invite works CCMS_INVITE_DAYS days, a reset link one hour.

Forgot password? shows on the sign-in page only when email (CCMS_MAIL_URL) and CCMS_PUBLIC_URL are set. It answers the same whether or not the address is known, and sends a reset link only to a person who has a password.

Passwords

  • Between 12 and 256 characters, not a common password and not the person's own address. There are no rules about character classes.
  • Stored only as an argon2id hash.
  • Setting a password through a link, or changing it in the account menu, ends the person's other sessions.

Lockout

Failed sign-ins count twice. Past either limit the answer is 429 too-many-failed-attempts with Retry-After, before any password is checked:

CountedSettingDefault
per client addressCCMS_AUTH_FAILURES_MAX, CCMS_AUTH_FAILURES_WINDOW_MS20 a minute
per account (address)CCMS_PASSWORD_FAILURES_MAX, CCMS_PASSWORD_FAILURES_WINDOW_MS10 in 15 minutes

The count per client address is kept in each server's memory. Behind a reverse proxy, every client shares the proxy's address unless CCMS_TRUST_PROXY is right (reverse proxy). The count per account is kept in the database, shared by every server, so it holds behind a shared address too. "Forgot password" requests count apart, so failed sign-ins never block a reset.

Sessions

Password sessions follow the same limits as the provider's: 8 hours without a request (CCMS_SESSION_IDLE_MINUTES) and 7 days at most (CCMS_SESSION_MAX_HOURS). Turning CCMS_PASSWORD_SIGN_IN off stops the password sessions.

Leave the shared token unset

Where people sign in, leave CCMS_API_TOKEN and CCMS_EDITOR_API_TOKEN unset. Unlike OpenID Connect, password sign-in does not refuse the shared token, and with it anyone who reaches the editor reads every draft without signing in. The API warns at start-up.

Without passwords

CCMS_PASSWORD_SIGN_IN=off leaves OpenID Connect, codes by email (only when CCMS_EMAIL_CODE_SIGN_IN=on) and service account tokens. With none of these set up, the editor's sign-in page says that sign-in is not set up.

On this page