tju-yxq opened a new pull request, #5390:
URL: https://github.com/apache/rocketmq-dashboard/pull/5390
### Which Issue(s) This PR Fixes
- Fixes #5389
### Brief Description
Flags credentials chosen by someone other than their owner and makes the
owner rotate them at the next login:
- `rmq_studio_user` gains `password_must_change` (TINYINT(1), default 0);
`StudioUserSchemaMigration` adds it to existing databases following the
established startup-migration pattern (metadata-checked, idempotent,
missing-table tolerant). Pre-existing accounts default to **no rotation
pending** — their passwords were set by their owners, and an upgrade must not
lock anyone out.
- `createUser` flags the initial password; the admin-reset path of
`changePassword` (`requireCurrentPassword == false`) sets the flag while the
self-service path clears it — a password chosen by its owner needs no rotation.
- `LoginVO.UserInfo` carries `mustChangePassword`, and the user management
table shows a "rotation due" tag (with an explaining tooltip) on flagged
accounts.
- The login page replaces its form with a change-password step when the flag
is set. Because the change revokes the current session (existing
`changePassword` behavior), the flow signs in again with the new password and
proceeds — the handed-out credential cannot reach the console beyond that first
rotation.
- The properties-based (in-memory) mode is unchanged: its users rotate
passwords by editing configuration.
Existing `changePassword` semantics (validation, session revocation,
transaction) are unchanged.
### How Did You Test This Change?
Focused suites on the branch (Windows, Java 21, Node 20; based on
`rocketmq-studio` at `6a68042f`):
```
cd server && mvn
'-Dtest=StudioUserSchemaMigrationTest,AuthServiceDatabaseTest,AuthServiceTest,AuthControllerTest,StudioUserControllerTest'
test
[INFO] Tests run: 2, Failures: 0 ... -- in ...StudioUserSchemaMigrationTest
[INFO] Tests run: 9, Failures: 0 ... -- in ...AuthControllerTest
[INFO] Tests run: 34, Failures: 0 ... -- in ...AuthServiceDatabaseTest
[INFO] Tests run: 16, Failures: 0 ... -- in ...AuthServiceTest
[INFO] Tests run: 5, Failures: 0 ... -- in ...StudioUserControllerTest
[INFO] BUILD SUCCESS
```
Six new tests: the H2 migration adds the column without touching rows (which
default to false), is idempotent, and skips a missing table; the admin-reset
path writes `password_must_change = true` into the update while the
self-service path writes false; a created account's insert carries the flag;
and a login reports `mustChangePassword` true for a flagged account and false
for a settled one.
```
cd web && npm test -- login/index.test.tsx UserManagement.test.tsx --run
Test Files 2 passed (1)
Tests 17 passed (17)
```
One new login test covers the full rotation flow: a flagged login does not
enter the app, the rotation form appears, submitting calls `changePassword`
with the handed-out password and the new one, the flow signs in again with the
new password, and only then do the auth store and navigation fire. The
user-management test asserts the rotation-due tag renders for a flagged account.
```
cd web && npm run lint
✖ 10 problems (0 errors, 10 warnings) # all pre-existing warnings in files
this PR does not touch
```
```
cd web && npx tsc -b --force
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]