Skip to content

Always render hidden CSRF token input in reusable non-crispy templates#3157

Merged
podliashanyk merged 2 commits intomasterfrom
fix-csrf-token-rendering-in-form-template
Nov 7, 2024
Merged

Always render hidden CSRF token input in reusable non-crispy templates#3157
podliashanyk merged 2 commits intomasterfrom
fix-csrf-token-rendering-in-form-template

Conversation

@podliashanyk
Copy link
Copy Markdown
Contributor

@podliashanyk podliashanyk commented Nov 5, 2024

A more robust version of #3056

This implementation means that CSRF token will be rendered also for GET forms (not so rare form type in NAV) which is a slight redundancy. At the same time it is a worthwhile one since this change means that _form_content.html template becomes reusable by forms that were originally non-crispy (with auto-included CSRF token). This is very handy for campus task # 45. Note that there is no (reliable) way to check whether a Django form is a POST form thats why this redundancy is needed.

Also see: #3140 (comment)

@podliashanyk podliashanyk requested a review from a team November 5, 2024 12:08
@podliashanyk podliashanyk self-assigned this Nov 5, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 5, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 992 0 11.14s
✅ PYTHON ruff 987 0 0.1s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 5, 2024

Test results

    9 files      9 suites   8m 31s ⏱️
2 135 tests 2 135 ✅ 0 💤 0 ❌
4 009 runs  4 009 ✅ 0 💤 0 ❌

Results for commit 713ce0f.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.41%. Comparing base (05dfb18) to head (713ce0f).
Report is 262 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3157      +/-   ##
==========================================
- Coverage   60.45%   60.41%   -0.04%     
==========================================
  Files         605      605              
  Lines       43745    43734      -11     
  Branches       48       48              
==========================================
- Hits        26448    26424      -24     
- Misses      17285    17298      +13     
  Partials       12       12              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

Very good, let's do this!

@johannaengland
Copy link
Copy Markdown
Contributor

But I would like to see a changelog file for this change

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Nov 6, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants