Skip to content

MFA workflow fixes - #13241

Merged
SchrodingersGat merged 11 commits into
inventree:masterfrom
SchrodingersGat:fix-mfa-unverified-email
Nov 14, 2026
Merged

SchrodingersGat merged 11 commits into
inventree:masterfrom
SchrodingersGat:fix-mfa-unverified-email

Conversation

@SchrodingersGat

Copy link
Copy Markdown
Member

- Fixes inventree#13238
- Verify email on successful password reset
- Invalidate password on account creation
- Fix MFA workflows
- Add regression tests
@SchrodingersGat SchrodingersGat added this to the 1.8.0 milestone Nov 10, 2026
@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed security Relates to a security issue setup Relates to the InvenTree setup / installation process backport Apply this label to a PR to enable auto-backport action backport-to-1.7.x Apply this label to backport a PR to the 1.7.x branch labels Nov 10, 2026
@netlify

netlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit dcad308
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6af7989f920bb64e32232b38
😎 Deploy Preview https://deploy-preview-13241--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94 (no change from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new assertion uses substring label matching, which selects both otp-secret and otp-secret-container and causes a strict-mode failure; it needs an exact label match.

1 open issue
What changed in this PR

This PR addresses #13238 by repairing onboarding for administrator-created users when MFA is mandatory, including email verification and recovery from blocked MFA setup.

Changes:

  • Verify a single matching email address after password reset and persist unusable passwords for new accounts.
  • Add verification-email resend and retry controls to MFA setup.
  • Add backend and frontend regression tests and document the workflow.
File Description
src/​frontend/​tests/​pui_login.spec.ts Tests email verification recovery during MFA setup.
src/​frontend/​src/​pages/​Auth/​MFASetup.tsx Adds verification guidance, resend, and retry controls.
src/​frontend/​src/​functions/​auth.tsx Handles unverified-email errors and sends verification requests.
src/​backend/​InvenTree/​users/​test_api.py Adds onboarding and password-reset verification tests.
src/​backend/​InvenTree/​users/​serializers.py Saves the new account’s unusable password.
src/​backend/​InvenTree/​users/​models.py Verifies eligible email addresses after password reset.
docs/​docs/​settings/​MFA.md Documents email verification requirements and recovery options.
CHANGELOG.md Records the password-reset verification change.

Review effort: Balanced

Comment thread src/frontend/tests/pui_login.spec.ts Resolved
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.35632% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.13%. Comparing base (435cdaa) to head (dcad308).
⚠️ Report is 3 commits behind head on master.

❌ Your patch check has failed because the patch coverage (9.09%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (85.89%) is below the target coverage (92.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13241      +/-   ##
==========================================
- Coverage   90.19%   85.13%   -5.07%     
==========================================
  Files         883     1076     +193     
  Lines       82311    92388   +10077     
  Branches     4251     4246       -5     
==========================================
+ Hits        74240    78652    +4412     
- Misses       7058    12731    +5673     
+ Partials     1013     1005       -8     
Flag Coverage Δ
backend 93.82% <97.22%> (+0.01%) ⬆️

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

Components Coverage Δ
Backend Apps 85.89% <98.68%> (-8.41%) ⬇️
Backend General 95.18% <ø> (-0.19%) ⬇️
Frontend 77.15% <9.09%> (+0.11%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair matmair left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; the ci failures should be fixed by #13273 and not be blocking

@SchrodingersGat
SchrodingersGat merged commit 12c1600 into inventree:master Nov 14, 2026
60 of 64 checks passed
@SchrodingersGat
SchrodingersGat deleted the fix-mfa-unverified-email branch November 14, 2026 02:35
@github-actions

Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
❌ 1.7.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 13241

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

SchrodingersGat added a commit that referenced this pull request Nov 14, 2026
* MFA workflow fixes

- Fixes #13238
- Verify email on successful password reset
- Invalidate password on account creation
- Fix MFA workflows
- Add regression tests

* Update docs

* Update OTP secret expectation to use exact match



* Attempt to fix flaky test

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Apply this label to a PR to enable auto-backport action backport-to-1.7.x Apply this label to backport a PR to the 1.7.x branch bug Identifies a bug which needs to be addressed security Relates to a security issue setup Relates to the InvenTree setup / installation process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New users are blocked after enabling "Force MFA".

3 participants