Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@armanraymagit
Copy link

@armanraymagit armanraymagit commented Dec 17, 2025

Screenshot 2025-12-17 121350
  • Updated the Login.html file and setting.py
  • Now after invalid username/email or password is entered than message is display as shown in screenshot
  • Updated setting.py for both username/email login as mention in issue for django‐allauth
    Tested on local setup works fine and verified.

Summary by CodeRabbit

  • Chores
    • Improved application startup sequence to ensure environment variables from configuration files are properly loaded before the application initializes.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Contributor

👋 Hi @armanraymagit!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbitai
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@github-actions github-actions bot added the needs-peer-review PR needs peer review label Dec 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

Refactors manage.py by introducing a main() function that loads environment variables from a .env file using dotenv before setting Django configuration and running commands. Moves existing startup logic from the module-level if __name__ == "__main__": block into the new function.

Changes

Cohort / File(s) Summary
Dotenv initialization setup
manage.py, requirements.txt
Added main() function to manage.py that loads environment variables via dotenv.load_dotenv() before configuring Django settings and running CLI. Updated requirements.txt to include python-dotenv dependency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify dotenv.load_dotenv() is called before Django settings module is set
  • Confirm python-dotenv dependency is correctly added to requirements.txt
  • Check that all original startup logic is preserved in the new main() function

Suggested labels

quality: medium

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes fixing login error messages, but the only changes shown are adding a main() function to manage.py for loading environment variables from .env—unrelated to login credentials or error handling. Update the PR title to accurately reflect the actual changes (e.g., 'Load environment variables in manage.py via dotenv'), or ensure the commit/files match the title's intent about login error messages.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

📊 Monthly Leaderboard

Hi @armanraymagit! Here's how you rank for December 2025:

Rank User PRs Reviews Comments Total
#15 @manikandanchandran 2 0 1 22
#16 @armanraymagit 2 0 0 20
#17 @aryanghai12 2 0 0 20

Leaderboard based on contributions in December 2025. Keep up the great work! 🚀

@github-actions github-actions bot added the pre-commit: passed Pre-commit checks passed label Dec 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
manage.py (1)

6-10: Good approach to load environment variables before Django initialization.

Encapsulating startup logic in main() and loading .env via dotenv correctly addresses the PostgreSQL configuration issue. The python-dotenv dependency is properly declared in pyproject.toml (version ^1.1.0).

Optional: Move import to module level.

While the local import works, moving it to the top with other imports aligns with Python conventions:

 #!/usr/bin/env python
 import os
 import sys
+from dotenv import load_dotenv


 def main():
-    from dotenv import load_dotenv
-
     load_dotenv()
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between cd7312d and d991515.

📒 Files selected for processing (1)
  • manage.py (1 hunks)
⏰ 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: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
manage.py (1)

18-19: LGTM!

Clean refactor that properly delegates to the new main() function.

@github-project-automation github-project-automation bot moved this from Backlog to Ready in 📌 OWASP BLT Project Board Dec 17, 2025
@github-actions github-actions bot added the tests: passed Django tests passed label Dec 17, 2025
@armanraymagit armanraymagit marked this pull request as draft December 17, 2025 07:25
@armanraymagit armanraymagit marked this pull request as ready for review December 17, 2025 07:25
@armanraymagit armanraymagit deleted the fix/Show-an-error-message-on-incorrect-login-credentials-and-fix-verify-email-page-UI branch December 17, 2025 07:28
@github-actions
Copy link
Contributor

❌ Tests failed

The Django tests found issues that need to be fixed. Please review the test output below and fix the failing tests.

How to run tests locally

# Install dependencies
poetry install --with dev

# Run all tests
poetry run python manage.py test

# Run tests with verbose output
poetry run python manage.py test -v 3

# Run a specific test
poetry run python manage.py test app.tests.TestClass.test_method
Test output (last 100 lines)
"""
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 623, in run
    self._callTestMethod(testMethod)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 579, in _callTestMethod
    if method() is not None:
       ^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/utils.py", line 456, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/BLT/BLT/website/tests/test_main.py", line 182, in test_post_bug_full_url
    self.assertIn("XSS Attack on Google", body.text)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 1140, in assertIn
    self.fail(self._formatMessage(msg, standardMsg))
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 703, in fail
    raise self.failureException(msg)
AssertionError: 'XSS Attack on Google' not found in 'A server error occurred.  Please contact the administrator.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 466, in _run_subsuite
    result = runner.run(subsuite)
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 381, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/suite.py", line 122, in run
    test(result)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/testcases.py", line 321, in __call__
    self._setup_and_call(result)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/testcases.py", line 376, in _setup_and_call
    super().__call__(result)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 678, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 622, in run
    with outcome.testPartExecutor(self):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 74, in testPartExecutor
    _addError(self.result, test_case, exc_info)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/case.py", line 97, in _addError
    result.addFailure(test, exc_info)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 311, in addFailure
    self.check_picklable(test, err)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 219, in check_picklable
    self._confirm_picklable(err)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 189, in _confirm_picklable
    pickle.loads(pickle.dumps(obj))
                 ^^^^^^^^^^^^^^^^^
TypeError: cannot pickle 'traceback' object
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/work/BLT/BLT/manage.py", line 19, in <module>
    main()
  File "/home/runner/work/BLT/BLT/manage.py", line 15, in main
    execute_from_command_line(sys.argv)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
    super().run_from_argv(argv)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/core/management/commands/test.py", line 63, in handle
    failures = test_runner.run_tests(test_labels)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 1099, in run_tests
    result = self.run_suite(suite)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 1026, in run_suite
    return runner.run(suite)
           ^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/runner.py", line 217, in run
    test(result)
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.11/lib/python3.11/site-packages/django/test/runner.py", line 553, in run
    subsuite_index, events = test_results.next(timeout=0.1)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/multiprocessing/pool.py", line 873, in next
    raise value
TypeError: cannot pickle 'traceback' object

For more information, see the Django testing documentation.

@github-actions github-actions bot added tests: failed Django tests failed and removed tests: passed Django tests passed labels Dec 17, 2025
@armanraymagit armanraymagit restored the fix/Show-an-error-message-on-incorrect-login-credentials-and-fix-verify-email-page-UI branch December 17, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 2 PR changes 2 files needs-peer-review PR needs peer review pre-commit: passed Pre-commit checks passed quality: medium tests: failed Django tests failed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant