Skip to content
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

[#1452] Added middleware to hide django-cms toolbar when not 2FA verified #618

Merged
merged 1 commit into from
May 15, 2023

Conversation

Bartvaderkin
Copy link
Contributor

@Bartvaderkin Bartvaderkin commented May 15, 2023

I tried a bunch of approaches, like putfing an if/else around the template tag, extending the regular ToolbarMiddleware, extending the template tag and some others, but this is the simplest that doesn't break anything.

It seems to work in browser, if it is acceptable I'll figure out how to create a test for this tomorrow.

Comment on lines +37 to +39
request.session["cms_edit"] = False
request.session["cms_preview"] = False
request.session["cms_toolbar_disabled"] = True
Copy link
Contributor Author

@Bartvaderkin Bartvaderkin May 15, 2023

Choose a reason for hiding this comment

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

We might not even need these but the CMS code is really messy in when/where is looks into these so I'd just clobber them before setting the most important toolbar.show_toolbar = False

@codecov-commenter
Copy link

Codecov Report

Merging #618 (515e12a) into develop (b443ca7) will decrease coverage by 0.03%.
The diff coverage is 94.44%.

@@             Coverage Diff             @@
##           develop     #618      +/-   ##
===========================================
- Coverage    96.50%   96.48%   -0.03%     
===========================================
  Files          598      598              
  Lines        20545    20563      +18     
===========================================
+ Hits         19827    19840      +13     
- Misses         718      723       +5     
Impacted Files Coverage Δ
src/open_inwoner/cms/utils/middleware.py 96.55% <94.11%> (-3.45%) ⬇️
src/open_inwoner/conf/base.py 95.40% <100.00%> (+0.02%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alextreme alextreme merged commit 2f9d18e into develop May 15, 2023
@alextreme alextreme deleted the feature/1452-toolbar-2fa-only branch May 15, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants