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

feat: Allow organisation admins to mandate 2fa for their organisation #2877

Conversation

novakzaballa
Copy link
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

  • Enable the Enforce 2FA function (This feature is not enabled for users who log in with SSO and/or SAML)

How did you test this code?

  • Go to Organisation Settings
  • In the "General" tab enable Enforce 2FA
  • Log in with an account that does not have Two-Factor Authentication enabled

@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Oct 23, 2023 8:01pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview Oct 23, 2023 8:01pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview Oct 23, 2023 8:01pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard api Issue related to the REST API labels Oct 23, 2023
@novakzaballa novakzaballa linked an issue Oct 23, 2023 that may be closed by this pull request
@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2023

Uffizzi Preview deployment-39238 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b0ef013) 95.60% compared to head (a89c6fa) 95.61%.
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2877   +/-   ##
=======================================
  Coverage   95.60%   95.61%           
=======================================
  Files        1009     1010    +1     
  Lines       28904    28914   +10     
=======================================
+ Hits        27634    27645   +11     
+ Misses       1270     1269    -1     
Files Coverage Δ
...isations/migrations/0047_organisation_force_2fa.py 100.00% <100.00%> (ø)
api/organisations/models.py 93.67% <100.00%> (+0.04%) ⬆️
api/organisations/serializers.py 93.65% <ø> (ø)

... and 3 files with indirect coverage changes

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

@novakzaballa novakzaballa requested review from a team and gagantrivedi October 23, 2023 20:19
@@ -275,7 +275,7 @@ const App = class extends Component {
)
}
if (AccountStore.forced2Factor()) {
Copy link
Member

@kyle-ssg kyle-ssg Oct 24, 2023

Choose a reason for hiding this comment

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

I think instead of making all of the isLoginChanges, just adjust this function to return false if 2fa has been set. It should remove the need for any other frontend change in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was made to handle the case where you are already logged in, your organization forces 2factor and you disable your 2factor, it prevents the page from reloading, which does happen if 2factor is enabled on login.

@@ -381,8 +385,12 @@ const store = Object.assign({}, BaseStore, {
return false
}

if (store.samlOrOauth) {
Copy link
Member

Choose a reason for hiding this comment

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

Can be replaced with my other suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This prevents the 2factor from being forced on Oauth or Saml accounts

@novakzaballa
Copy link
Contributor Author

@kyle-ssg Can you re-review, please?

@dabeeeenster dabeeeenster added this to the Front End ToDo milestone Nov 13, 2023
@novakzaballa novakzaballa added this pull request to the merge queue Nov 13, 2023
Merged via the queue into main with commit 1d006fb Nov 13, 2023
20 checks passed
@novakzaballa novakzaballa deleted the feat/allow-organisation-admins-to-mandate-2fa-for-their-organisation branch November 13, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow organisation admins to mandate 2fa for their organisation
4 participants