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

Usage limits 2fa fixes #4561

Merged
merged 14 commits into from Aug 2, 2023

Conversation

LMNTL
Copy link
Contributor

@LMNTL LMNTL commented Jul 28, 2023

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a description of your work suitable for publishing on our forum
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

Small changes to how MFA configuration is sent to the browser.

Notes

The frontend environment variable mfa_allowed has been split into three values:

  • mfa_allowed: tracks whether MFA is enabled on the server level
  • mfa_per_user_availability: tracks whether the current user has MFA per-user availability set
  • mfa_has_availability_list: tracks whether any users have MFA per-user availability set

@LMNTL LMNTL requested a review from noliveleger July 28, 2023 18:59
jsapp/js/account/security/mfa/mfaSection.component.tsx Outdated Show resolved Hide resolved
if (!envStore.data.stripe_public_key) {
// If Stripe isn't enabled on the site, don't restrict MFA access
mfaActions.hasActiveSubscription.completed(true);
mfaActions.getMfaAvailability.completed({
isMfaAvailable: hasMfaList && mfaAvailableToUser,
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition does not work when MFA is enabled and there is not per-user availability list. MFA section never shows up.
It could be changed to isMfaAvailable: !hasMfaList || (hasMfaList && mfaAvailableToUser),

jsapp/js/actions/mfaActions.ts Outdated Show resolved Hide resolved
kpi/views/environment.py Outdated Show resolved Hide resolved
@noliveleger noliveleger added API Changes related to API endpoints Back end Front end labels Aug 2, 2023
@noliveleger noliveleger self-assigned this Aug 2, 2023
@LMNTL LMNTL requested a review from noliveleger August 2, 2023 18:57
@noliveleger noliveleger merged commit 1b7930f into feature/usage-limits Aug 2, 2023
4 checks passed
@noliveleger noliveleger deleted the feature/usage-limits-2fa-fixes branch August 2, 2023 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes related to API endpoints Back end Front end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants