Skip to content

feat(01): Teen delegated login - #43

Open
tpaulshippy wants to merge 9 commits into
mainfrom
feature/roadmap-01-teen-login
Open

feat(01): Teen delegated login#43
tpaulshippy wants to merge 9 commits into
mainfrom
feature/roadmap-01-teen-login

Conversation

@tpaulshippy

@tpaulshippy tpaulshippy commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Roadmap 01: Teen Delegated Login

Implements #53.

What changed

  • Backend: Profile oauth_email binding, delegated JWT tokens with is_teen_delegated claim, GET /api/profiles/self, permission gating (teens can't mutate parent resources)
  • Frontend: Session mode detection, teen-delegated route guard, parent settings email binding UI, profile editor teen sign-in field
  • Tests: 113 backend (31 new), 70 frontend (19 new), e2e walkthrough

Manual demo

  1. Seed: manage.py seed_e2e_teen_login → log in as parent
  2. Settings → Profiles → Maya → bind [email protected]
  3. Second device: sign in with Google/Apple (email [email protected]) → app locks to Maya, no Settings access
  4. Teen can chat and study; parent mutations return 403

Evidence

Teen Login screenshot

https://github.com/tpaulshippy/bots/raw/feature/roadmap-01-teen-login/evidence/pr43-teen-login.mp4

tpaulshippy and others added 8 commits August 25, 2026 11:26
…profile lock (roadmap 01)

- Unique constraint + index on active Profile.oauth_email; case-insensitive
  login lookup excluding soft-deleted profiles and preferring parent login
- SyftRefreshToken issues parent-user JWTs with is_teen_delegated +
  active_profile_id claims; forwarded via jwt_template.html deep link and
  /app/login web redirect
- IsParentSession / IsParentSessionForWrites guard profiles, bots, /api/user
  PIN, and account deletion; redacted GET /api/user for teens
- Profile lock enforced in chat creation/reply, chats, decks, flashcards
  querysets; new GET /api/profiles/self read-self endpoint for teens
- oauth_email on ProfileSerializer (empty string unbinds); tutorial copy
  now describes invite-email teen sign-in
- New test suite test_delegated_login.py (31 tests)
… 01)

Idempotent seeding of parent user e2e-test-user / testpassword123,
teen profile Maya bound to [email protected], sibling Leo, default
AiModel + Penelope bot for fresh databases.
…email binding UI (roadmap 01)

- tokens.ts stores is_teen_delegated + active_profile_id claims; helpers
  getSessionMode/sessionFromQueryParams parse login query flags
- useAuthBootstrap locks delegated devices to /profiles/self and skips the
  parent profile-repair path; login.tsx skips PIN gate/caching for teens
- useSessionMode hook drives NavigationDrawer (Chats+Flashcards only for
  teens) and _layout redirect of /parent/* deep links to /chat
- setSelectedProfile refuses changes when delegated
- profileEditor gains 'Teen sign-in email' with validation, help copy,
  Remove teen sign-in action, and testIDs on new interactive elements
…on (roadmap 01)

- New tokens.test.ts (query flag parsing, getSessionMode claims,
  clearUser claim reset), useAuthBootstrap deep-link lock tests,
  NavigationDrawer mode tests, useDelegatedRouteGuard redirect tests
- Extract /parent/* guard from _layout into useDelegatedRouteGuard
  for testability
- Extend '@/api/tokens' mocks in existing suites for the new
  getSessionMode surface; add delegated-lock cases to
  useSelectedProfile tests
- e2e/01-teen-login.e2e.js: parent drawer intact, bind/unbind teen email
  round-trip via profile editor with API verification, delegated session
  hides Settings, /parent/* deep link bounces off parent area; teen JWTs
  minted via backend venv (SyftRefreshToken.for_delegated_profile)
- testIDs: drawer-menu-button, drawer items, menu-profiles,
  profile-card-{name}; index.tsx honors injected e2eInitialRoute under
  e2eTestMode
- Backend: fix I001 import ordering in permissions, serializers, views, tests
- Frontend: add jest/e2e globals to eslint config
tpaulshippy pushed a commit that referenced this pull request Aug 26, 2026
Screenshot now shows the teen login screen with Google/Apple sign-in buttons.
Screenshot now shows the teen login screen with Google/Apple sign-in buttons.
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