Skip to content

Feat/account#175

Merged
duguwanglong merged 6 commits intomainfrom
feat/account_fix
Apr 24, 2026
Merged

Feat/account#175
duguwanglong merged 6 commits intomainfrom
feat/account_fix

Conversation

@Jieatgit
Copy link
Copy Markdown
Contributor

add account login module and auth module

- Add login/setup-admin/force-change-password pages and auth-guarded routing
- Rewrite AdminUsers page with self-service password reset
- Integrate require_user guard into session routes

Made-with: Cursor
…175 follow-up)

- Make /api/channel/{channel_id}/webhook public via PUBLIC_PATH_REGEXES
  so external IM platforms (DingTalk / WeCom / Feishu) can deliver
  callbacks without 401; plugin handle_webhook retains full signature
  validation ownership and no synthetic admin user is injected.
- Add AuthService.reassign_orphan_sessions and `flocks admin
  reassign-orphan-sessions` CLI to backfill empty owner_user_id on
  sessions created by CLI / background / inbound dispatchers, so
  later-added member accounts can still see them.
- Document remote-TUI / SDK API-token flow, reverse-proxy
  X-Forwarded-For requirement, and one-time-password operational
  caveats in README.md / README_zh.md (new section 4.4).
- Add unit coverage for the webhook regex, the channel-webhook
  no-credentials passthrough, and the reassign helper (dry-run,
  role guard, orphan filter).

Made-with: Cursor
Driven by a deeper second pass over the previous fix:

- AuthService.reassign_orphan_sessions now wraps each Session.update in
  its own try/except, returning a new ``failed`` counter so a single
  storage error no longer aborts the whole pass.
- ``flocks admin reassign-orphan-sessions`` drops the duplicated admin
  pre-check (single-sourced in the service layer via ValueError),
  removes the misleading ``# noqa: UP006`` annotation and the
  ``{"role": -1}`` magic sentinel, surfaces ``failed`` in the CLI
  output, and exits with code 2 when any update failed so CI / scripts
  can react.
- PUBLIC_PATH_REGEXES uses a non-capturing ``(?:api/)?`` group and
  documents (a) the built-in DingTalk / WeCom plugins still run in
  stream mode (so the webhook entrypoint is for external / custom
  plugins only) and (b) a TODO to add the provider OAuth-callback path
  once it leaves stub state.
- README.md / README_zh.md §4.4 distinguishes server-side
  ``generate-api-token`` (persists on the server) from client-side
  ``set-api-token`` (writes the same token into the client's local
  secret store), adds a curl smoke test, calls out the built-in webhook
  caveat, and documents the new ``failed`` counter / exit-code-2
  behaviour.
- Add a partial-failure unit test (one orphan raises mid-loop, the
  other two still get rewritten) and update the existing dry-run /
  rewrite assertions for the new ``failed`` field.

Made-with: Cursor
@duguwanglong duguwanglong merged commit 9424189 into main Apr 24, 2026
2 checks passed
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.

3 participants