massenergize / api

Backend Code for Massenergize Portal. This provides the API to the backend database, and is shared by the various front-end portal projects.
MIT License
5 stars 8 forks source link

fix: Fix for "CSRF verification failed. Request aborted." issue in Django Admin login on Dev and Canary. #1054

Closed abdullai-t closed 3 months ago

abdullai-t commented 3 months ago

Summary / Highlights

This Pull Request addresses the issue where login attempts into the Django Admin site from Dev and Canary environments were aborting due to a CSRF verification failure.

The problem was fixed by adding the CSRF_TRUSTED_ORIGINS setting in the main Django's setting file. The values for ALLOWED_HOSTS are used to set this new setting, ensuring all domains in ALLOWED_HOSTS are recognized as trusted origins for CSRF protection.

Details (Give details about what this PR accomplishes, include any screenshots etc)

Testing Steps (Provide details on how your changes can be tested)

Requirements (place an x in each [ ])

Transparency (Project board)
codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 52.88%. Comparing base (6eed8c3) to head (3b03baf). Report is 6 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1054 +/- ## ========================================== - Coverage 52.89% 52.88% -0.01% ========================================== Files 423 423 Lines 31301 31306 +5 ========================================== + Hits 16556 16557 +1 - Misses 14745 14749 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.