Skip to content

[B6/B7] Inject ConfigService into password.utils, move getPasswordHistoryLimit, add tests, update docs#840

Merged
nanaf6203-bit merged 5 commits into
MettaChain:mainfrom
zakkiyyat:feature/auth-configservice-injection
Jun 28, 2026
Merged

[B6/B7] Inject ConfigService into password.utils, move getPasswordHistoryLimit, add tests, update docs#840
nanaf6203-bit merged 5 commits into
MettaChain:mainfrom
zakkiyyat:feature/auth-configservice-injection

Conversation

@zakkiyyat

Copy link
Copy Markdown
Contributor

Closes #711 (B6a) — password.utils.ts: inject ConfigService instead of reading process.env directly
Closes #712 (B6b) — Add unit test confirming getPasswordPolicy reflects env-driven overrides
Closes #713 (B7a) — security.utils.ts: move getPasswordHistoryLimit into AuthService
Closes #714 (B7b) — Document PASSWORD_HISTORY_LIMIT config key in README env-var table

Changes

  • src/auth/password.utils.ts: Refactored getPasswordPolicy and validatePassword to accept ConfigService and use configService.get() instead of process.env
  • src/auth/auth.service.ts: Updated all callers to pass this.configService; moved getPasswordHistoryLimit as a private method
  • src/auth/security.utils.ts: Removed getPasswordHistoryLimit
  • test/auth/password.utils.spec.ts: Rewrote tests to use mockConfig() helper instead of process.env overrides; added `getPasswordPolicy) unit tests
  • README.md: Added PASSWORD_HISTORY_LIMIT to env-var table

All 199 tests pass.

Copy link
Copy Markdown
Contributor

⚠️ Couldn't auto-merge (likely conflicts with main). Could you rebase onto main and ping me? Once clean I'll bring it in. 🙏

Copy link
Copy Markdown
Contributor

⏳ Tried again but the branch still has conflicts with main. Could you git rebase origin/main and push? Once clean I'll bring it in. 🙏

zakkiyyat and others added 2 commits June 28, 2026 08:02
- Add ipAddress and userAgent parameters to preflightChecks
- Pass them from login() to preflightChecks
- Fix mock in auth.service.captcha.spec.ts (add isVerified: true)
- Remove hardcoded 365-day throw in getAnalytics, cap instead
- Add fixed timestamps to blockchain.service.spec.ts tests

@nanaf6203-bit nanaf6203-bit 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.

LGTM

@nanaf6203-bit nanaf6203-bit merged commit 8265b2e into MettaChain:main Jun 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants