fix(auth): normalize email storage and lookup handling#327
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughEmail normalization (lowercase + trim) is applied consistently at write time across all three user creation flows in ChangesEmail Normalization at Write Paths
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/public-api/src/controllers/userAuth.controller.js`:
- Around line 1343-1346: The response format in the user creation endpoint does
not conform to the required API response envelope. The current response returns
an object with message and user properties, but it must return an object with
success (boolean), data (containing the user information), and message
properties. Restructure the res.status(201).json() call to wrap the user object
in a data property and add a success property set to true, while keeping the
message property.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4cc090bc-cf98-4b09-9796-64c76f2f6d36
📒 Files selected for processing (1)
apps/public-api/src/controllers/userAuth.controller.js
|
@VarshithReddy2006 fix the issue reported by coderabbit |
|
I reviewed the CodeRabbit comment. This PR is scoped specifically to Issue #321 (email normalization). The I intentionally kept the PR limited to normalizing email storage and lookup behavior to avoid introducing unrelated API-contract changes in the same bug fix. If you'd prefer the response envelope to be standardized for Thank you. |
|
fix that in this PR |
|
Hi @yash-pouranik, I've updated the {
"success": true,
"data": {
"user": {}
},
"message": "User created successfully"
}The email-normalization changes remain unchanged; this update only addresses the requested response-format consistency for this endpoint. Thank you. |
Fixes #321
Summary
This PR normalises email addresses before both storage and lookup across authentication flows.
Changes
Problem
Authentication flows performed normalised email lookups, while some user creation paths stored raw email values. This could lead to inconsistencies for mixed-case email addresses and make authentication behaviour dependent on how the email was originally stored.
Result
Email storage and lookup now use the same canonical representation (
toLowerCase().trim()) across the affected authentication flows, ensuring consistent behaviour and reliable email matching.Summary by CodeRabbit