Skip to content

fix(users): show password validation errors - #43191

Open
aminghadersohi wants to merge 3 commits into
apache:masterfrom
aminghadersohi:aminghadersohi/show-user-password-validation-error
Open

fix(users): show password validation errors#43191
aminghadersohi wants to merge 3 commits into
apache:masterfrom
aminghadersohi:aminghadersohi/show-user-password-validation-error

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Surface field-level validation messages returned by the user API for HTTP 400 responses. Flask-AppBuilder uses 400 for Marshmallow validation errors such as password-complexity failures, while duplicate username/email database errors remain 422 and retain their existing friendly messages.

This keeps the API's established status-code contract intact rather than changing a shared Flask-AppBuilder endpoint. Client-side password-complexity checks are intentionally not duplicated because minimum length and blocklists are operator-configurable server policy.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Submitting a password shorter than the configured minimum showed the generic red toast: “There was an error creating the user. Please, try again.”

After: The same submission shows the server-provided reason in the red toast: “Password must be at least 8 characters long.” (The number follows the server's configured policy.)

TESTING INSTRUCTIONS

  1. Open Settings → List Users → + User as an administrator.
  2. Complete the required fields and submit matching passwords shorter than the configured minimum.
  3. Confirm the toast displays the specific minimum-length validation message and the user is not created.
  4. Try creating a user with an existing username and confirm the existing friendly duplicate-username toast remains unchanged.

Automated test:

cd superset-frontend
npm run test -- src/features/users/utils.test.ts

The focused Jest suite passes (3 tests). Pre-commit formatting, linting, custom rules, and style checks pass. The targeted type-check hook cannot complete in this fresh worktree because generated packages/*/lib declarations have not been built; its reported errors are in unrelated existing files.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.19048% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.65%. Comparing base (2eedc60) to head (bbcae50).

Files with missing lines Patch % Lines
superset-frontend/src/features/users/utils.ts 84.21% 3 Missing ⚠️
...rset-frontend/src/features/users/UserListModal.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43191   +/-   ##
=======================================
  Coverage   66.64%   66.65%           
=======================================
  Files        2873     2873           
  Lines      163628   163629    +1     
  Branches    37767    37769    +2     
=======================================
+ Hits       109052   109066   +14     
+ Misses      52447    52434   -13     
  Partials     2129     2129           
Flag Coverage Δ
javascript 73.77% <76.19%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi
aminghadersohi marked this pull request as ready for review August 14, 2026 22:58
@dosubot dosubot Bot added change:frontend Requires changing the frontend global:users Related to users and roles labels Aug 14, 2026
@bito-code-review

bito-code-review Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #93627a

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/features/users/utils.ts - 1
Review Details
  • Files reviewed - 3 · Commit Range: 4bfa5ec..bbcae50
    • superset-frontend/src/features/users/UserListModal.tsx
    • superset-frontend/src/features/users/utils.test.ts
    • superset-frontend/src/features/users/utils.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend global:users Related to users and roles size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant