feat: add reset password functionality to workspace UI#4561
feat: add reset password functionality to workspace UI#4561GanJiaKouN16 wants to merge 1 commit into
Conversation
Wire the existing GenerateResetLinkModal and PasswordResetLinkModal into the Actions dropdown in the workspace members table. - Add 'Reset password' menu item for workspace members (not self) - Add resetPassword API function in profile service - Show confirmation dialog before generating the reset link - Display the generated password reset link with copy functionality Closes Agenta-AI#2572
|
Someone is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds a reset-password service and integrates a two-step UI (generate confirmation modal → show generated reset link) into workspace member actions, including state, handler, menu item, and modal rendering. ChangesPassword Reset Feature
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 37087706-bd2f-4e66-80b9-d9df41281977
📒 Files selected for processing (2)
web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsxweb/oss/src/services/profile/index.ts
| export const resetPassword = async (userId: string): Promise<string> => { | ||
| const base = getBaseUrl() | ||
| const url = new URL("api/profile/reset-password", base) | ||
| url.searchParams.set("user_id", userId) | ||
| const data = await fetchJson<string>(url, { | ||
| method: "POST", | ||
| }) | ||
| return data | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Use the Fern-generated client instead of raw fetchJson.
The coding guidelines require new frontend API code to use the Fern-generated client. A resetUserPassword method already exists in the generated client (see web/packages/agenta-api-client/src/generated/api/resources/users/client/Client.ts).
Additionally, fetchJson<string> uses a generic type parameter, but the fetchJson signature returns Promise<any> without generic support—this type assertion has no runtime effect.
Suggested refactor using Fern client
-import {fetchJson, getBaseUrl} from "../../lib/api/assets/fetchClient"
+import {fetchJson, getBaseUrl} from "../../lib/api/assets/fetchClient"
+import {getAgentaSdkClient} from "`@/oss/lib/api/assets/agentaSdkClient`"
+import {getAgentaApiUrl} from "`@/oss/lib/helpers/utils`"-export const resetPassword = async (userId: string): Promise<string> => {
- const base = getBaseUrl()
- const url = new URL("api/profile/reset-password", base)
- url.searchParams.set("user_id", userId)
- const data = await fetchJson<string>(url, {
- method: "POST",
- })
- return data
-}
+export const resetPassword = async (userId: string): Promise<string> => {
+ const client = getAgentaSdkClient({host: getAgentaApiUrl()})
+ const response = await client.users.resetUserPassword({user_id: userId})
+ return response as string
+}Source: Coding guidelines
d7f2378 to
6eaecdd
Compare
Summary
Wire the existing
GenerateResetLinkModalandPasswordResetLinkModalcomponents into the Actions dropdown in the workspace members table, enabling workspace admins to generate password reset links for users.Changes
web/oss/src/services/profile/index.tsresetPassword(userId)API function that callsPOST /profile/reset-password?user_id=...web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsxhandleResetPasswordhandler that:GenerateResetLinkModalconfirmation dialogPasswordResetLinkModalwith the generated link for copyingHow it works
Screenshots
The existing
GenerateResetLinkModalandPasswordResetLinkModalcomponents were already implemented but not wired up — this PR connects them to the UI.Closes #2572