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: adding capture for 2fa enforcements at org level #26660

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

surbhi-posthog
Copy link
Contributor

Problem

We want to capture when the user toggle 2fa for everyone in the org

Changes

No UX changes, just capturing logs in the backend

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Cloud: Yes

How did you test this code?

Tested locally and added tests:

env) surbhijhavar@Surbhis-MacBook-Pro posthog % pytest /Users/surbhijhavar/posthog/posthog/api/test/test_organization.py
=============================================== test session starts ================================================
platform darwin -- Python 3.11.10, pytest-8.0.2, pluggy-1.5.0
django: settings: posthog.settings (from ini)
rootdir: /Users/surbhijhavar/posthog
configfile: pytest.ini
plugins: inline-snapshot-0.12.1, icdiff-0.6, flaky-3.7.0, cov-4.1.0, asyncio-0.21.1, mock-3.11.1, Faker-17.5.0, split-0.9.0, django-4.5.2, env-0.8.2, anyio-4.6.2.post1, xdist-3.6.1, syrupy-4.6.4
asyncio: mode=Mode.STRICT
collected 15 items                                                                                                 

posthog/api/test/test_organization.py ...............                                                        [100%]
================================================= inline snapshot ==================================================

============================== 15 passed in 3.46s ==============================

Toggle on/off and ensured the log is captured:
image

@surbhi-posthog surbhi-posthog requested a review from a team December 4, 2024 21:29
@surbhi-posthog surbhi-posthog marked this pull request as ready for review December 4, 2024 21:30
@surbhi-posthog surbhi-posthog marked this pull request as draft December 4, 2024 21:34
@surbhi-posthog
Copy link
Contributor Author

moving this back to draft mode to address failing tests

@surbhi-posthog surbhi-posthog marked this pull request as ready for review December 4, 2024 21:49
@zlwaterfield
Copy link
Contributor

@surbhi-posthog the first failure was Backend CI / Python code quality checks so you can run mypy -p posthog | mypy-baseline filter locally to see what's happening.

@surbhi-posthog
Copy link
Contributor Author

@surbhi-posthog the first failure was Backend CI / Python code quality checks so you can run mypy -p posthog | mypy-baseline filter locally to see what's happening.

The issue was related to typechecking the user_id. I've added the changes and ran all test again to verify everything passes.

@surbhi-posthog surbhi-posthog merged commit 2919e27 into master Dec 5, 2024
91 checks passed
@surbhi-posthog surbhi-posthog deleted the backend_2fa_capture branch December 5, 2024 20:13
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.

2 participants