-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add ability to enforce 2FA for all members of the team #5855
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
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3f1bc40
Introduce `force_2fa` team policy and add API for toggling it
zoldar 2cb7afc
Implement 2FA enforcement
zoldar 26ecc8b
Make team policy available to CE too
zoldar b9ac5ef
Improve copy (h/t @metmarkosaric)
zoldar d09e6ee
Send email to all team members when enforcing 2FA is enabled
zoldar 556c7b1
Only owners can enable and disable enforcing 2FA
zoldar 1e786b9
Don't send email to the user who enabled enforcing 2FA
zoldar c0a12f8
Add team selection screen to 2FA enforce exceptions
zoldar 60b1c4c
Fix email URL
zoldar 9493e5d
Add tests
zoldar 12923b1
Hide the Force 2FA section for non-owners completely
zoldar 1245137
Improve e-mail formatting
zoldar 88d4604
Point at 2FA docs page for now
zoldar 04c7d9b
Add changelog entry
zoldar ce7574a
Reverse the exception to make dialyzer happy
zoldar e532997
Fix a typo
zoldar 6486d13
Fix typespec :clown_face: (h/t @ukutaht)
zoldar bfb5b09
Deliver force 2FA email notifications asynchronously
zoldar edc6774
Fix a typo in AlpineJS variable name (h/t @ukutaht)
zoldar d45de07
Put parameter in path helper instead of concatenating it as a string
zoldar 550d3c8
Improve and test audit logging of toggling 2FA enforcement
zoldar f98c1a9
Introduce 3 second delay before redirect
zoldar 34e9836
Test audit logging only on EE
zoldar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
lib/plausible_web/templates/auth/force_initiate_2fa_setup.html.heex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <script> | ||
| document.addEventListener("DOMContentLoaded", function () { | ||
| setInterval(function() { | ||
| document.getElementById("initiate-2fa-form").submit(); | ||
| }, 3000) | ||
| }); | ||
| </script> | ||
|
|
||
| <.focus_box> | ||
| <:title> | ||
| Setup Two-Factor Authentication | ||
| </:title> | ||
|
|
||
| <:subtitle> | ||
| Redirecting to 2FA setup. Click below if it doesn't happen automatically. | ||
| </:subtitle> | ||
|
|
||
| <div class="w-full"> | ||
| <.form | ||
| id="initiate-2fa-form" | ||
| action={Routes.auth_path(@conn, :initiate_2fa_setup, force: "true")} | ||
| for={@conn.params} | ||
| method="post" | ||
| > | ||
| <.button type="submit" class="w-full" mt?={false}> | ||
| Proceed | ||
| </.button> | ||
| </.form> | ||
| </div> | ||
| </.focus_box> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
lib/plausible_web/templates/email/force_2fa_enabled.html.heex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| {@enabling_user.email} has enabled a 2FA requirement for the "{@team.name}" team.<br /><br /> | ||
| Please | ||
| <a href={ | ||
| Routes.auth_url(PlausibleWeb.Endpoint, :force_initiate_2fa_setup, __team: @team.identifier) | ||
| }> | ||
| set up 2FA now | ||
| </a> | ||
| to keep access to your team on Plausible. The setup takes about a minute with any authenticator app.<br /><br /> | ||
| Need help? Read our <a href="https://plausible.io/docs/2fa">2FA guide</a> | ||
| or reply to this email. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.