Skip to content

feat: add reset password functionality to workspace UI#4561

Open
GanJiaKouN16 wants to merge 1 commit into
Agenta-AI:mainfrom
GanJiaKouN16:feat/reset-password-workspace-ui
Open

feat: add reset password functionality to workspace UI#4561
GanJiaKouN16 wants to merge 1 commit into
Agenta-AI:mainfrom
GanJiaKouN16:feat/reset-password-workspace-ui

Conversation

@GanJiaKouN16
Copy link
Copy Markdown

Summary

Wire the existing GenerateResetLinkModal and PasswordResetLinkModal components 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.ts

  • Added resetPassword(userId) API function that calls POST /profile/reset-password?user_id=...

web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx

  • Added "Reset password" menu item in the Actions dropdown for workspace members (visible only for other members, not for self)
  • Added handleResetPassword handler that:
    1. Opens the GenerateResetLinkModal confirmation dialog
    2. Calls the reset password API on confirmation
    3. Shows the PasswordResetLinkModal with the generated link for copying

How it works

  1. Click the gear icon (⋮) on any workspace member row
  2. Select "Reset password" from the dropdown
  3. A confirmation dialog appears: "Are you sure you want to generate reset password link?"
  4. Click "Generate Link" to confirm
  5. The API generates a SuperTokens password reset link
  6. A modal displays the link with a Copy button for sharing with the user

Screenshots

The existing GenerateResetLinkModal and PasswordResetLinkModal components were already implemented but not wired up — this PR connects them to the UI.

Closes #2572

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
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

Someone is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Feature Request New feature or request labels Jun 6, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 6, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 6, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e92b6d7d-388a-4a43-acf8-dd3a68a37979

📥 Commits

Reviewing files that changed from the base of the PR and between d7f2378 and 6eaecdd.

📒 Files selected for processing (2)
  • web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
  • web/oss/src/services/profile/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/src/services/profile/index.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added password reset capability in workspace member management: admins can generate and retrieve password reset links from the member actions menu.
    • Flow includes confirmation and result modals, loading feedback, and error notifications to guide secure link generation and sharing.

Walkthrough

This 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.

Changes

Password Reset Feature

Layer / File(s) Summary
Reset Password Service Endpoint
web/oss/src/services/profile/index.ts
New resetPassword(userId) async function sends a POST to api/profile/reset-password with user_id query parameter and returns the generated reset link string.
Component Setup and Handler Logic
web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
Adds Key icon and resetPassword import, imports GenerateResetLinkModal and PasswordResetLinkModal, introduces component state for modal visibility, generated link, and loading, and implements handleResetPassword to call the service, manage modal transitions, store the link, and handle errors.
UI Menu Item and Modal Rendering
web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
Adds "Reset password" item to member actions dropdown (stops propagation, opens generation modal) and renders both modals wired with handlers, loading state, and the generated link.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add reset password functionality to workspace UI' directly and accurately summarizes the main change—adding password reset capabilities to the workspace member management interface.
Description check ✅ Passed The description is comprehensive and well-related to the changeset, detailing the API function addition and UI integration with clear explanations of the user flow and implementation approach.
Linked Issues check ✅ Passed All coding requirements from issue #2572 are met: 'Reset Password' action added to workspace UI [#2572], confirmation dialog implemented [#2572], reset password API called on confirmation [#2572], and generated link displayed for copying [#2572].
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives; no out-of-scope modifications detected. Changes are limited to password reset feature implementation as specified in #2572.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 98b8a9d and d7f2378.

📒 Files selected for processing (2)
  • web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
  • web/oss/src/services/profile/index.ts

Comment on lines +64 to +72
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
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ 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

@GanJiaKouN16 GanJiaKouN16 force-pushed the feat/reset-password-workspace-ui branch from d7f2378 to 6eaecdd Compare June 6, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Request New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGE-2166] Add Reset Password Functionality to Workspace UI

2 participants