Skip to content

Email members their git + mailbox credentials on provisioning#57

Merged
ralyodio merged 4 commits into
mainfrom
feat/notify-creds
Jun 23, 2026
Merged

Email members their git + mailbox credentials on provisioning#57
ralyodio merged 4 commits into
mainfrom
feat/notify-creds

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

When a member's accounts are provisioned, email their verified address the info they need to actually use them — previously the generated Forgejo password was discarded, so members could never sign in to the git web UI.

Git (Forgejo / AgentGit)

  • forgejo.EnsureUser now returns the generated temporary password instead of throwing it away (kept must_change_password: true).
  • Added Config.LoginURL() (…/user/login).
  • provisionGit emails the web login link + username + one-time password on account creation. Best-effort: a mail failure is logged, never blocks BBS verification.

Mail (forwardemail alias)

  • ensurePremium emails the member their <name>@<mail-domain> address + webmail link right after the alias is created. (The mailbox is a forwarding alias, so there's no separate password — address + webmail link only.)

Backfill: agentbbs notify-creds

Accounts created before this change got a discarded password and can't log in. New subcommand re-emails working creds to existing verified members:

  • EnsureUserReset creates the account if missing, or resets an existing account's password to a fresh one-time password (PATCH /admin/users/{name}), so it always returns usable creds.
  • Preview by default; --send actually resets passwords + sends. --git / --mail narrow scope; --user a,b targets specific members. Skips unverified/banned/no-email users. Warns (not fails) when Forgejo/forwardemail unconfigured; errors if SMTP unconfigured under --send.

Testing

  • go build ./..., go vet, gofmt -l clean.
  • go test ./... green (new EnsureUser/EnsureUserReset tests cover create + reset paths and that the returned password matches what's sent).
  • Verified with Go 1.26.4 (repo pins go 1.26; host has 1.22).

Notes / follow-ups

  • notify-creds --send clobbers any password a member set themselves (hence preview-by-default).
  • Mail creds are address + webmail link only; password-protected Mailu mailboxes would be a separate, larger change.

🤖 Generated with Claude Code

ralyodio and others added 4 commits June 23, 2026 09:35
… area + mgmt TUI

Implements M4 (Files). A fully virtual Go SFTP server (pkg/sftp + crypto/ssh,
no OS users) wired as an "sftp" subsystem on the existing :22 wish listener, so
members reach their files with their login key:

    sftp files@bbs.profullstack.com     # scp/rsync ride the same endpoint

Identity is the SSH key (the username is conventional/ignored). Two areas per
session: a private, quota-limited /me workspace and a single shared public file
area /public (old-school BBS file area; world-read, members-only write by
default, operator-moderated). This reverses the old NG1 "no sharing" boundary in
favour of one sanctioned, inspectable sharing surface (PRD §9.3 amended).

internal/files:
- backend.go  service, layout, quota/usage, live-session registry, operator API
- fs.go       per-session virtual FS; resolve() is the single security
              chokepoint (area confinement + symlink-escape guard) + pkg/sftp
              request handlers
- server.go   subsystem handler: key auth -> member session -> request server,
              with byte metering and force-disconnect
- tui.go      in-BBS member browser (hub plugin "Files")
- admin.go    operator management TUI: sessions, workspaces/quotas, public area

Operator console: ssh sftp@<host> (allowlist-gated; sftpadmin@/filesadmin@
aliases) — list/disconnect sessions, set per-user quotas, revoke SFTP access,
toggle public write, moderate the public area.

store: files_access (per-user quota override + revoked) and files_settings
(public-write mode) tables + methods. main.go wiring guarded by AGENTBBS_FILES
(+ AGENTBBS_FILES_QUOTA_MB, default 1 GiB). Route names reserved.

Tests (incl -race): path traversal/confinement, symlink-escape rejection,
public-write ACL, quota enforcement, usage accounting, and an end-to-end run
against a real SFTP client. Docs: docs/files.md; PRD §5.3/§5.3.1/§9.3 + README
updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`agentbbs notify-creds` backfills credential emails to verified members
who signed up before the git/mailbox welcome emails existed.

- git (all verified): forgejo.EnsureUserReset resets each account to a
  fresh one-time password (must-change) and emails the web login link,
  username, and password. New method since the original one-time
  password is not recoverable for existing accounts.
- mailbox (all verified): ensures the forwardemail alias and emails the
  address + webmail link.
- Preview by default; --send executes. --git/--mail/--user filters.
  Refuses --send without SMTP; warns+skips when Forgejo/forwardemail
  are unconfigured.

Also folds in the welcome-email functions (gitWelcomeEmailBody,
mailWelcomeEmailBody, EnsureUser password return, provisionGit/
ensurePremium sends) that this builds on. README ops + forgejo tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts:
#	cmd/agentbbs/main.go
#	internal/auth/auth.go
#	internal/store/store.go
# Conflicts:
#	cmd/agentbbs/main.go
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​pkg/​sftp@​v1.13.1094100100100100

View full report

@ralyodio ralyodio merged commit ce0758b into main Jun 23, 2026
5 checks passed
@ralyodio ralyodio deleted the feat/notify-creds branch June 23, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant