Skip to content

fix(auth): remove password min_length validation from LoginRequest - #1692

Merged
imDarshanGK merged 5 commits into
imDarshanGK:mainfrom
Vaishnavi10706:fix/loginrequest-password-validation
Jul 27, 2026
Merged

fix(auth): remove password min_length validation from LoginRequest#1692
imDarshanGK merged 5 commits into
imDarshanGK:mainfrom
Vaishnavi10706:fix/loginrequest-password-validation

Conversation

@Vaishnavi10706

@Vaishnavi10706 Vaishnavi10706 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes the login request validation by removing the min_length=8 constraint from the LoginRequest schema.

Previously, login requests with passwords shorter than 8 characters were rejected with a 422 Unprocessable Entity response before reaching the authentication logic. Password complexity rules should only be enforced during account creation, not during login.

Changes Made

  • Removed min_length=8 from LoginRequest.password.
  • Retained max_length=128 to guard against excessively large inputs.
  • Added a regression test to ensure login requests are not rejected by schema validation due to password length.

Related Issue

Fixes #1679

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • I have read CONTRIBUTING.md
  • My branch is up to date with main
  • I have run pytest -v (relevant authentication tests) and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Test evidence

pytest backend/tests/test_auth_endpoints.py

============================= test session starts =============================
...
============================= 9 passed in 5.05s =============================

@imDarshanGK imDarshanGK left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@Vaishnavi10706

Copy link
Copy Markdown
Contributor Author

@imDarshanGK I have made this changes . now all checks are passed
whenever you get time please review it and tell me if any other changes are required ?
Thank you

@imDarshanGK imDarshanGK added type:enhancement Documentation related changes good first issue Beginner friendly tasks gssoc2026 Official GSSoC 2026 issue type:backend Backend related tasks level:beginner Beginner friendly type:accessibility Accessibility and usability improvements performance Performance improvement gssoc:approved needs review Waiting for maintainer review labels Jul 27, 2026
@imDarshanGK imDarshanGK added type:testing Testing related changes and improvements and removed needs review Waiting for maintainer review labels Jul 27, 2026
@imDarshanGK
imDarshanGK merged commit c8126d5 into imDarshanGK:main Jul 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Beginner friendly tasks gssoc:approved gssoc2026 Official GSSoC 2026 issue level:beginner Beginner friendly performance Performance improvement type:accessibility Accessibility and usability improvements type:backend Backend related tasks type:enhancement Documentation related changes type:testing Testing related changes and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: LoginRequest incorrectly enforces min_length=8 on password field

2 participants