apache / apache/rocketmq-dashboard

[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt

Open
#4,252 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

The create-user dialog on the Studio user management page (`web/src/pages/studio/UserManagement.tsx`) keeps its form mounted across open/close cycles. The cancel path (`onCancel`, line ~513) only closes the dialog: there is no `resetFields()` and no `destroyOnHidden`. The form is only reset on the create-success path (`createUser`, lines ~179-180) and in the reset-password dialog of the same file.

## Evidence

1. Open the create dialog, type a username, an initial password and enable the admin switch.
2. Cancel (or press Esc / click the mask).
3. Reopen the dialog: the username, the initial password and the admin switch are still filled.
4. Change only the username and submit: `createStudioUser` is called with the previous attempt's initial password and `admin: true` from the cancelled attempt.

A regression test demonstrating the residue on the unfixed code lives in the linked PR.

## Impact

An operator who cancels an attempt and later creates a different user can unknowingly create an admin account and reuse a password they believed was discarded. The created account is elevated and its credential is not the one the operator chose for it.

## Expected behavior

Dismissing the dialog without creating resets the form to its initial values, so the next attempt starts from a clean username, password and admin switch.

## Related work

The same page's reset-password dialog already resets on cancel, and the create-success path resets the form; sibling create dialogs reset on cancel (`cluster/index.tsx` NameServer create, `instance/index.tsx` create/edit). Issue #4251 records the same residue class for the maintenance-window dialog on the system alerts page.

## PR

Fix: #4253.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/pages/studio/UserManagement.tsx, reading the create-user dialog's onCancel path around line 513 and the createUser reset around lines 179-180. The linked regression test demonstrates the residue; done means dismissing the dialog leaves the next attempt with clean username, password, and admin values.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.