Repository navigation
fix(auth): unify all login failure paths to the generic error message - #1107
Conversation
All authentication failure paths in service.go now return the same "Check your email address and password and try again" message, matching what the test suite asserts (closes #993). Extracts a genericLoginError constant so the text is defined in one place. Update service_test.go, service_lockout_test.go, and handler_auth_test.go to assert the current message (the OWASP invariant test continues to guard against any future divergence). Closes #993
|
Warning Review limit reached
More reviews will be available in 33 minutes and 11 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review Generated by Claude Code |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details
gh pr view 1107 --repo LeanerCloud/CUDly
echo "=== FILES CHANGED ==="
gh pr diff 1107 --repo LeanerCloud/CUDlyLength of output: 9783
All six updated return sites use // service.go — all six return sites
return nil, errors.New(genericLoginError) // getUserAndValidateStatus (×3)
return errors.New(genericLoginError) // verifyPasswordAndMFA (×3)
Everything else looks good:
🧠 Learnings used |
|
@coderabbitai review Generated by Claude Code |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr view 1107 --repo LeanerCloud/CUDly
echo "=== FILES CHANGED ==="
gh pr diff 1107 --repo LeanerCloud/CUDlyLength of output: 9850
// current
return nil, fmt.Errorf(genericLoginError)
// preferred
return nil, errors.New(genericLoginError)
Everything else is still ✅ — constant scoping, test assertions, OWASP invariant guard all look correct. Just the 🧠 Learnings used✅ Action performedReview finished.
|
Summary
All authentication failure paths in
service.gonow return the same"Check your email address and password and try again"message, resolving the test failure that was keeping base CI red.genericLoginErrorconstant so the text is defined once inservice.go(closes issue fix(auth): login error message inconsistent -> base CI red (TestLogin_WithMFA_NoSecret) #993).getUserAndValidateStatusandverifyPasswordAndMFAthat previously returned the old"invalid email or password"string are updated.service_test.go,service_lockout_test.go, andhandler_auth_test.goupdated to assert the current message; theTestLogin_OWASPEnumerationInvariantregression guard continues to enforce uniformity across all six failure modes.Verification
go test ./internal/auth/- all tests pass includingTestLogin_WithMFA_NoSecret/wrong_password_returns_same_generic_error(previously failing) andTestLogin_OWASPEnumerationInvariant(all six subcases).go build ./...- clean.Closes #993