Pick reset-password target from a list of existing users - #1065
Open
PatrickRose wants to merge 1 commit into
Open
Pick reset-password target from a list of existing users#1065PatrickRose wants to merge 1 commit into
PatrickRose wants to merge 1 commit into
Conversation
Replace the free-text username field on the admin reset-password page with a dropdown populated from the users on the system. - Add a `list()` method to the user repository returning all usernames - Add a login-gated GET /api/user/list endpoint - Fetch the list with SWR and render it via SelectInput, with loading and empty states Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #1061. The admin reset-password page previously had a free-text username field; you had to type an exact username. This replaces it with a dropdown populated from the users currently on the system, so an admin selects who to reset.
Changes
src/server/repository/user/index.ts/mongo.ts— add alist()method to the user repository returning all usernames (fetched with a_id-only projection).src/pages/api/user/list.ts— new login-gatedGETendpoint returning{ users: string[] }. Gated onisLoggedInlike the other admin routes, since a full user list is enumeration-sensitive (unlike the public/api/games).src/types/io-ts-def.ts/types.d.ts—UserListAPIDecode/UserListAPI.src/pages/admin/reset-password.tsx— fetch the list with SWR and render it through the existingSelectInputcomponent, with loading (Loading users...) and empty (There are no users to reset.) states. The submit path and forced-reset behaviour are unchanged.Testing
next buildsucceeds;/api/user/listand/api/user/resetboth compile as server routestsc --noEmit,eslint, andprettier --check(repo-pinned 3.9.4) all clean for the changed files🤖 Generated with Claude Code