Conversation
… add disposable email validation for magic link requests.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR removes the email/password login endpoint across backend, frontend, and mobile layers. It eliminates the LoginView class and LoginSerializer, removes login/register from JWT and organization context exemptions in middleware, removes related tests, and adds disposable email domain validation to magic-link requests via a new dependency. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ 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.
Pull request overview
This PR removes the email/password authentication flow from the application, consolidating authentication to use only magic links and Google OAuth. The cleanup removes unused backend endpoints, serializers, tests, and frontend/mobile API configurations. Additionally, it adds disposable email domain validation to the magic link authentication flow to prevent abuse.
Changes:
- Removed LoginView backend endpoint and all related email/password login functionality
- Removed registration endpoint references from mobile and middleware configurations
- Added disposable email domain blocking to magic link requests using the disposable-email-domains library
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/common/views/auth_views.py | Removed LoginView class that handled email/password authentication |
| backend/common/urls.py | Removed login endpoint URL pattern and LoginView import |
| backend/common/serializer.py | Removed LoginSerializer and authenticate import; added disposable email validation to MagicLinkRequestSerializer |
| backend/common/middleware/rls_context.py | Removed login and register paths from exempt paths list |
| backend/common/middleware/get_company.py | Removed login and register paths from auth skip paths |
| backend/common/tests/test_multitenancy.py | Removed TestLoginWithOrgContext test class |
| backend/common/tests/test_auth.py | Removed TestLoginView test class and updated file docstring |
| backend/requirements.txt | Added disposable-email-domains>=0.0.162 dependency |
| frontend/src/lib/api.js | Removed auth.login() method implementation |
| mobile/lib/config/api_config.dart | Removed login and register endpoint getters |
Files not reviewed (1)
- frontend/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def validate_email(self, value): | ||
| domain = value.rsplit("@", 1)[-1].lower() | ||
| if domain in disposable_domains: | ||
| raise serializers.ValidationError( | ||
| "Disposable email addresses are not allowed." | ||
| ) | ||
| return value |
There was a problem hiding this comment.
The disposable email validation added to MagicLinkRequestSerializer is a good security improvement, but it lacks test coverage. Consider adding tests to verify that disposable email domains are properly rejected and legitimate domains are allowed. This is especially important since the existing test file (backend/common/tests/test_magic_link.py) has comprehensive tests for other aspects of magic link functionality but doesn't test this validation.
| django_storages==1.14.6 | ||
|
|
||
| django-crum==0.7.9 | ||
| disposable-email-domains>=0.0.162 |
There was a problem hiding this comment.
The version specification for disposable-email-domains uses '>=' which is inconsistent with the rest of the requirements.txt file where all other dependencies use exact version pinning with '=='. While using '>=' makes sense for a data-only package that frequently updates its blocklist, it could introduce unexpected changes. Consider using '==' for consistency and predictability, updating the version periodically when needed, or add a comment explaining why this package needs flexible versioning.
| disposable-email-domains>=0.0.162 | |
| disposable-email-domains==0.0.162 |
Summary by CodeRabbit
Bug Fixes
Chores
Removed Features