Skip to content

feat(api): add admin password reset endpoint#51

Merged
fclairamb merged 4 commits intomainfrom
feat/admin-password-reset
Jan 24, 2026
Merged

feat(api): add admin password reset endpoint#51
fclairamb merged 4 commits intomainfrom
feat/admin-password-reset

Conversation

@fclairamb
Copy link
Copy Markdown
Owner

Summary

  • Add ability for administrators to reset any user's password using their web session token
  • New endpoint POST /api/v1/users/:uid/reset-password requires web session (rejects API keys) and admin role
  • Frontend includes new ResetPasswordDialog component and updated users page with dropdown menu for actions

Changes

Backend

  • Add handleResetPassword handler in internal/api/auth.go
  • Register route in internal/api/server.go
  • Update OpenAPI specification with new endpoint and schema

Frontend

  • Add ResetPasswordDialog component
  • Add canResetPassword permission helper
  • Update users page with dropdown menu (reset password + delete user actions)
  • Regenerate API types from OpenAPI spec

Testing

  • Add comprehensive E2E tests in front/e2e/admin-password-reset.spec.ts
  • API tests: admin can reset, non-admin forbidden, password validation, user not found
  • UI tests: admin can reset via dialog, password mismatch validation

Test plan

  • All 53 E2E tests pass
  • Go linter passes
  • TypeScript compiles without errors
  • Frontend builds successfully

🤖 Generated with Claude Code

fclairamb and others added 4 commits January 23, 2026 23:57
Add ability for administrators to reset any user's password using
their web session token, without requiring re-authentication.

Backend:
- Add POST /api/v1/users/:uid/reset-password endpoint
- Require web session (reject API keys for security)
- Require admin role
- Validate password length (min 8 chars)
- Log admin actions

Frontend:
- Add ResetPasswordDialog component
- Add canResetPassword permission helper
- Update users page with dropdown menu for actions
- Include reset password and delete user options

Testing:
- Add E2E tests for API and UI functionality
- Test permission enforcement
- Test password validation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add check to prevent admins from using the reset-password endpoint
to reset their own password. Admins should use the regular password
change endpoint which requires the current password.

This maintains proper audit trail distinction between:
- "admin reset another user's password" (reset-password endpoint)
- "user changed their own password" (password change endpoint)

Tests:
- Add Go integration tests for password reset endpoint
- Add E2E test for self-reset prevention

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Exclude password_reset_test.go from paralleltest linter (tests share DB state)
- Fix canonical header name in ratelimit_test.go (X-Ratelimit-Limit)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add canonicalheader exclusion for ratelimit_test.go since X-RateLimit-Limit
  is the correct industry-standard header format
- Revert header back to X-RateLimit-Limit (was incorrectly changed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@fclairamb fclairamb enabled auto-merge (squash) January 24, 2026 00:04
@fclairamb fclairamb merged commit 529fc92 into main Jan 24, 2026
5 checks passed
@fclairamb fclairamb deleted the feat/admin-password-reset branch January 24, 2026 00:07
@fclairamb fclairamb mentioned this pull request Jan 23, 2026
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