-
Notifications
You must be signed in to change notification settings - Fork 0
Login #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: slandath <jesus_slanda@yahoo.com>
Signed-off-by: slandath <jesus_slanda@yahoo.com>
WalkthroughIntroduces email-based authentication form, adds custom login/logout views and URLs, creates a login template, configures authentication redirects, makes the home page login-required, and conditionally renders navbar elements for authenticated users. Changes
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
home/templates/base.html (1)
18-56: Move the{% endif %}to after the collapse container’s closing</div>--- home/templates/base.html @@ around line 55 - {% endif %} </ul> - </div> + </div> + {% endif %}
🧹 Nitpick comments (6)
accounts/forms.py (2)
41-46: Add UX/accessibility attrs to the email input.Improve autofill and mobile keyboards.
Apply:
widget=forms.EmailInput( attrs={ "id": "email", "class": "form-control", + "autocomplete": "email", + "inputmode": "email", + "autocapitalize": "none", + "spellcheck": "false", + "autofocus": True, } ),
49-58: Enable password manager autofill.Set autocomplete to current-password.
widget=forms.PasswordInput( attrs={ "id": "password", "class": "form-control", + "autocomplete": "current-password", } ),accounts/urls.py (1)
8-9: Addapp_name = "accounts"for URL namespacing
Logout is already implemented via POST in your templates, so no changes needed there.accounts/views.py (1)
55-56: Removenext_pageoverride and enforce POST-only logoutDelete the
next_pageattribute inCustomLogoutViewso redirects useLOGOUT_REDIRECT_URL, and uncommenthttp_method_names = ["post"]to require a CSRF-protected POST. The logout link inhome/templates/base.html:48already uses a POST form.accounts/templates/login.html (1)
26-37: Minor UX: add autocomplete and autofocus to inputs.Improves browser autofill and mobile keyboard behavior.
- {{ form.password }} + {{ form.password.as_widget(attrs={'autocomplete': 'current-password'}) }}And for the email field above (if you adopt it):
- {{ form.email }} + {{ form.email.as_widget(attrs={'autocomplete': 'username', 'autofocus': 'autofocus'}) }}home/templates/base.html (1)
31-37: Optional: make “Campaigns” parent link keyboard-friendly.Consider adding
href="{% url 'campaigns' %}"plusdata-bs-toggle="dropdown"so Enter navigates and Space opens dropdown, or addrole="button"andaria-haspopup="true"/aria-expanded. Improves accessibility without changing behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
accounts/forms.py(2 hunks)accounts/templates/login.html(1 hunks)accounts/urls.py(1 hunks)accounts/views.py(2 hunks)fables/settings.py(1 hunks)home/templates/base.html(2 hunks)home/views.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
accounts/templates/login.html (1)
accounts/models.py (1)
Account(64-89)
accounts/urls.py (1)
accounts/views.py (2)
CustomLoginView(49-52)CustomLogoutView(55-56)
fables/settings.py (1)
accounts/migrations/0001_initial.py (1)
Migration(7-72)
accounts/views.py (2)
accounts/forms.py (1)
EmailAuthenticationForm(38-58)accounts/models.py (2)
Account(64-89)AccountManager(23-45)
accounts/forms.py (1)
accounts/models.py (2)
Account(64-89)AccountManager(23-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-and-push
- GitHub Check: build-and-push
🔇 Additional comments (11)
accounts/forms.py (2)
2-2: Correct import for overriding auth form.Using AuthenticationForm is the right base for customizing login fields.
38-47: Email-as-username aligns with USERNAME_FIELD='email'.Overriding the username field to EmailField with an EmailInput is appropriate here.
home/views.py (1)
1-6: login_required on home is correct and consistent with settings.This matches LOGIN_URL (/accounts/login) and the redirect flow.
fables/settings.py (1)
95-97: Redirect settings verified and consistent – theLOGIN_URL,LOGIN_REDIRECT_URL, andLOGOUT_REDIRECT_URLentries in settings.py correspond to theloginandlogoutroutes defined in accounts/urls.py. Optionally, you can switch to using named URL reversals instead of hard-coded paths.accounts/urls.py (1)
4-4: Direct imports for class-based views are fine.Keeps references explicit.
accounts/views.py (3)
4-4: Auth views import is correct.
7-7: Form import includes the custom EmailAuthenticationForm.
49-52: LoginView configuration looks solid.Template, form, and redirect_authenticated_user are all appropriate.
accounts/templates/login.html (2)
39-45: LGTM: non-field error rendering.Shows authentication errors (e.g., “invalid credentials”) clearly.
13-24: Do not change toform.email—the form intentionally definesusernameas an EmailField
EmailAuthenticationFormsubclassesAuthenticationFormand overrides itsusernamefield to be an email input. Replacingform.usernamewithform.emailwould break rendering and error handling.Likely an incorrect or invalid review comment.
home/templates/base.html (1)
48-53: Logout is correctly POST + CSRF.Good adherence to best practices; no changes needed.
Closes #64
Summary by CodeRabbit
New Features
Style
Changes