yyqdbngt opened a new pull request, #2876: URL: https://github.com/apache/rocketmq-dashboard/pull/2876
## Summary - Trim surrounding whitespace from the username before calling the login API (password is left untouched on purpose) - Reject whitespace-only usernames with the existing required-field validation (`whitespace: true`) - Tolerate a missing `user` object in the login payload: instead of a raw `TypeError` from `data.user.username`, the user sees the standard "login failed" message - Add regression tests for trimming, whitespace-only input, and a payload without a user ## Why Users commonly copy usernames from docs or spreadsheets, which drags along leading/trailing spaces; those were sent verbatim and failed with a cryptic backend 401 even though the account exists. Separately, `login()` returns `res.data.data`, which is `null` whenever the backend wraps the response in an unexpected envelope — `data.user.username` then threw `Cannot read properties of null`, and that raw TypeError leaked into the error toast. ## Testing - `./node_modules/.bin/vitest run src/pages/login/index.test.tsx` → 6 passed (3 new) - `./node_modules/.bin/tsc --noEmit` → clean - `./node_modules/.bin/eslint src/pages/login/index.tsx src/pages/login/index.test.tsx` → 0 errors -- 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]
