Skip to content

feat: add email change functionality and comprehensive E2E auth tests#122

Open
jakebromberg wants to merge 5 commits intomainfrom
test/e2e-auth-tests
Open

feat: add email change functionality and comprehensive E2E auth tests#122
jakebromberg wants to merge 5 commits intomainfrom
test/e2e-auth-tests

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Feb 2, 2026

Summary

  • Add self-service email change flow for users (with verification)
  • Add admin email override for locked-out users (bypasses verification)
  • Comprehensive E2E authentication test suite

Email Change Feature

Self-service flow:

  • EmailChangeModal component with password verification
  • Settings popup with read-only email + change button
  • Verification email sent to new address before change takes effect

Admin override flow:

  • Inline email editing in roster table
  • Changes bypass verification (for users locked out of old email)
  • Confirmation dialog warns about immediate effect

Test Coverage

  • 16 unit tests for EmailChangeModal
  • 13 E2E tests for self-service email change
  • 11 E2E tests for admin email change
  • Comprehensive E2E tests for login, logout, session, password reset, user management

Test plan

  • Self-service: Change email in settings, receive verification email, click link
  • Admin override: Change another user's email in roster, verify immediate update
  • Run npm run test:run - all 460 unit tests pass
  • Run E2E tests with backend running

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 2, 2026

Deploying wxyc-dj with  Cloudflare Pages  Cloudflare Pages

Latest commit: d98aacb
Status:🚫  Build failed.

View logs

@jakebromberg jakebromberg force-pushed the test/e2e-auth-tests branch 2 times, most recently from 0fff358 to e11bf9d Compare February 2, 2026 19:37
Copy link
Collaborator

@JacksonMeade JacksonMeade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way station manager permissions are managed here should be changed back to relying on the backend to bounce bad user requests.

import type { BetterAuthSessionResponse } from "@/lib/features/authentication/utilities";

/**
* POST /api/admin/organization/add-member
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a pass-through method to better-auth. This is still creating business logic around user auth in the frontend; the goal of the better-auth passthrough is that the backend is the authority on whether a request has the proper permissions. This should be backed out in favor of error handling from the backend, which should already be automatically handled.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Removed both app/api/admin/capabilities/route.ts and app/api/admin/organization/add-member/route.ts — the frontend was duplicating authorization checks that belong in the backend.

AccountEntry.tsx now calls authClient.admin.updateUser() directly for capability updates, and RosterTable.tsx was already calling authClient.organization.addMember() directly, so the add-member route was unused.

See commit f8e77db.

Jake Bromberg added 3 commits February 25, 2026 18:01
- Add self-service email change flow for users (with verification)
- Add admin email override for locked-out users (bypasses verification)
- Add capability management UI to roster
- Add comprehensive E2E authentication test suite
- Update components for Better Auth compatibility
- Add onboarding flow for incomplete users
- Add theme preference persistence
- Update login and password reset UI for Better Auth
- Add admin Better Auth integration
- Update Redux store and hooks for Better Auth
- Remove legacy authentication APIs
- Add Better Auth client and core infrastructure
…ctly

Remove app/api/admin/capabilities/route.ts and
app/api/admin/organization/add-member/route.ts which duplicated
authorization logic that belongs in the backend.

AccountEntry.tsx now calls authClient.admin.updateUser() directly for
capability updates, letting the backend be the authority on permissions.
Mini component now receives audioRef, isPlaying, onTogglePlay,
audioContext, analyserNode, and animationFrameRef as props instead of
managing audio state internally via forwardRef. Update tests to provide
these required props and verify the callback-driven interface.
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.

2 participants