This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 627bc8181 fix(users): reload the list and the session overview after a 
password reset (#6937)
627bc8181 is described below

commit 627bc81813f1ad7ab37926223bcaf09b866b3f52
Author: bai mengxuan <[email protected]>
AuthorDate: Fri Nov 27 12:23:16 2026 +0800

    fix(users): reload the list and the session overview after a password reset 
(#6937)
---
 web/src/pages/studio/UserManagement.tsx                |  4 ++++
 web/src/pages/studio/__tests__/UserManagement.test.tsx | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/web/src/pages/studio/UserManagement.tsx 
b/web/src/pages/studio/UserManagement.tsx
index acfd30d95..8bef6344a 100644
--- a/web/src/pages/studio/UserManagement.tsx
+++ b/web/src/pages/studio/UserManagement.tsx
@@ -387,6 +387,10 @@ const UserManagementPage = () => {
         message.success(t('userMgmt.passwordChanged'));
       } else {
         await resetStudioUserPassword(passwordTarget.id, values.newPassword);
+        // The server revokes every active session of that user as part of the 
reset, so the rows
+        // and the session overview are stale the moment it succeeds; the 
other mutations (enable,
+        // revoke) refresh through this same counter.
+        setRefreshVersion((version) => version + 1);
         message.success(t('userMgmt.passwordReset'));
       }
       setPasswordTarget(null);
diff --git a/web/src/pages/studio/__tests__/UserManagement.test.tsx 
b/web/src/pages/studio/__tests__/UserManagement.test.tsx
index ad8ab5065..b02bf0517 100644
--- a/web/src/pages/studio/__tests__/UserManagement.test.tsx
+++ b/web/src/pages/studio/__tests__/UserManagement.test.tsx
@@ -792,4 +792,20 @@ describe('UserManagementPage', () => {
       localStorage.removeItem(LANGUAGE_STORAGE_KEY);
     }
   });
+  it('reloads the users and the session overview after resetting a password', 
async () => {
+    const user = userEvent.setup();
+    renderPage();
+    await screen.findByText('operator');
+
+    await user.click(screen.getAllByRole('button', { name: /改密/ })[0]);
+    await user.type(screen.getByLabelText('新密码'), 'new-password-1');
+    await user.click(screen.getByRole('button', { name: 'OK' }));
+
+    // Resetting a password revokes that user's sessions on the server, so the 
page's counts and the
+    // overview card have to be read again - the other mutations refresh 
through the same counter.
+    await waitFor(() =>
+      
expect(vi.mocked(listStudioUsers).mock.calls.length).toBeGreaterThanOrEqual(2),
+    );
+    
expect(vi.mocked(getStudioUserSessionOverview).mock.calls.length).toBeGreaterThanOrEqual(2);
+  });
 });

Reply via email to