{"action":"created","comment":{"url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/comments/232853775","pull_request_review_id":174143940,"id":232853775,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjg1Mzc3NQ==","diff_hunk":"@@ -0,0 +1,21 @@\n+\"\"\"Middleware to check if staff user has 2FA unabled.\"\"\"\n+\n+from django.shortcuts import redirect\n+from django.urls import resolve, reverse\n+\n+\n+class Enforce2FAMiddleware:","path":"two_factor/middleware/enforce2fa.py","position":7,"original_position":7,"commit_id":"a56951efad8492f7d982c28f184573a1ab5075f5","original_commit_id":"a56951efad8492f7d982c28f184573a1ab5075f5","user":{"login":"moggers87","id":1490673,"node_id":"MDQ6VXNlcjE0OTA2NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/1490673?v=4","gravatar_id":"","url":"https://api.github.com/users/moggers87","html_url":"https://github.com/moggers87","followers_url":"https://api.github.com/users/moggers87/followers","following_url":"https://api.github.com/users/moggers87/following{/other_user}","gists_url":"https://api.github.com/users/moggers87/gists{/gist_id}","starred_url":"https://api.github.com/users/moggers87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moggers87/subscriptions","organizations_url":"https://api.github.com/users/moggers87/orgs","repos_url":"https://api.github.com/users/moggers87/repos","events_url":"https://api.github.com/users/moggers87/events{/privacy}","received_events_url":"https://api.github.com/users/moggers87/received_events","type":"User","site_admin":false},"body":"This package still supports Python 2.7 for Django 1.11, so that should be a subclass of `object`.","created_at":"2018-11-13T00:02:51Z","updated_at":"2018-11-13T00:03:43Z","html_url":"https://github.com/Bouke/django-two-factor-auth/pull/284#discussion_r232853775","pull_request_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/comments/232853775"},"html":{"href":"https://github.com/Bouke/django-two-factor-auth/pull/284#discussion_r232853775"},"pull_request":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284"}}},"pull_request":{"url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284","id":230246480,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwMjQ2NDgw","html_url":"https://github.com/Bouke/django-two-factor-auth/pull/284","diff_url":"https://github.com/Bouke/django-two-factor-auth/pull/284.diff","patch_url":"https://github.com/Bouke/django-two-factor-auth/pull/284.patch","issue_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/284","number":284,"state":"open","locked":false,"title":"Adds middleware to enforce 2fa","user":{"login":"singh1114","id":11356398,"node_id":"MDQ6VXNlcjExMzU2Mzk4","avatar_url":"https://avatars0.githubusercontent.com/u/11356398?v=4","gravatar_id":"","url":"https://api.github.com/users/singh1114","html_url":"https://github.com/singh1114","followers_url":"https://api.github.com/users/singh1114/followers","following_url":"https://api.github.com/users/singh1114/following{/other_user}","gists_url":"https://api.github.com/users/singh1114/gists{/gist_id}","starred_url":"https://api.github.com/users/singh1114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singh1114/subscriptions","organizations_url":"https://api.github.com/users/singh1114/orgs","repos_url":"https://api.github.com/users/singh1114/repos","events_url":"https://api.github.com/users/singh1114/events{/privacy}","received_events_url":"https://api.github.com/users/singh1114/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nAs far as I know, The current 2FA enforcement involves admin intervention. With the following change, people can directly include middleware in the settings file and things will work out of the box.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nWe are using this software for in our django app. We wanted to enforce 2FA. But the existing solution doesn't allowed the free movement and stopped the user from moving forward if the user has not enabled 2FA. \r\n\r\nWe wanted it differently, we wanted the users to move forward but only to the urls where the user can either `logout` or enable 2FA.\r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\r\n## Screenshots (if appropriate):\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [ ] My code follows the code style of this project.\r\n- [x] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [ ] I have added tests to cover my changes.\r\n- [ ] All new and existing tests passed.\r\n","created_at":"2018-11-12T19:40:31Z","updated_at":"2018-11-13T00:03:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a42f46a2e1b66da7be67a8d2df7a602bd1d294ab","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284/commits","review_comments_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284/comments","review_comment_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/284/comments","statuses_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/statuses/a56951efad8492f7d982c28f184573a1ab5075f5","head":{"label":"singh1114:enforce2fa-without-admin-intervention","ref":"enforce2fa-without-admin-intervention","sha":"a56951efad8492f7d982c28f184573a1ab5075f5","user":{"login":"singh1114","id":11356398,"node_id":"MDQ6VXNlcjExMzU2Mzk4","avatar_url":"https://avatars0.githubusercontent.com/u/11356398?v=4","gravatar_id":"","url":"https://api.github.com/users/singh1114","html_url":"https://github.com/singh1114","followers_url":"https://api.github.com/users/singh1114/followers","following_url":"https://api.github.com/users/singh1114/following{/other_user}","gists_url":"https://api.github.com/users/singh1114/gists{/gist_id}","starred_url":"https://api.github.com/users/singh1114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singh1114/subscriptions","organizations_url":"https://api.github.com/users/singh1114/orgs","repos_url":"https://api.github.com/users/singh1114/repos","events_url":"https://api.github.com/users/singh1114/events{/privacy}","received_events_url":"https://api.github.com/users/singh1114/received_events","type":"User","site_admin":false},"repo":{"id":157262306,"node_id":"MDEwOlJlcG9zaXRvcnkxNTcyNjIzMDY=","name":"django-two-factor-auth","full_name":"singh1114/django-two-factor-auth","private":false,"owner":{"login":"singh1114","id":11356398,"node_id":"MDQ6VXNlcjExMzU2Mzk4","avatar_url":"https://avatars0.githubusercontent.com/u/11356398?v=4","gravatar_id":"","url":"https://api.github.com/users/singh1114","html_url":"https://github.com/singh1114","followers_url":"https://api.github.com/users/singh1114/followers","following_url":"https://api.github.com/users/singh1114/following{/other_user}","gists_url":"https://api.github.com/users/singh1114/gists{/gist_id}","starred_url":"https://api.github.com/users/singh1114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singh1114/subscriptions","organizations_url":"https://api.github.com/users/singh1114/orgs","repos_url":"https://api.github.com/users/singh1114/repos","events_url":"https://api.github.com/users/singh1114/events{/privacy}","received_events_url":"https://api.github.com/users/singh1114/received_events","type":"User","site_admin":false},"html_url":"https://github.com/singh1114/django-two-factor-auth","description":"Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.","fork":true,"url":"https://api.github.com/repos/singh1114/django-two-factor-auth","forks_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/forks","keys_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/teams","hooks_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/hooks","issue_events_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/issues/events{/number}","events_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/events","assignees_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/assignees{/user}","branches_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/branches{/branch}","tags_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/tags","blobs_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/languages","stargazers_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/stargazers","contributors_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/contributors","subscribers_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/subscribers","subscription_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/subscription","commits_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/contents/{+path}","compare_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/merges","archive_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/downloads","issues_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/issues{/number}","pulls_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/labels{/name}","releases_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/releases{/id}","deployments_url":"https://api.github.com/repos/singh1114/django-two-factor-auth/deployments","created_at":"2018-11-12T19:06:01Z","updated_at":"2018-11-12T19:06:03Z","pushed_at":"2018-11-12T19:34:35Z","git_url":"git://github.com/singh1114/django-two-factor-auth.git","ssh_url":"git@github.com:singh1114/django-two-factor-auth.git","clone_url":"https://github.com/singh1114/django-two-factor-auth.git","svn_url":"https://github.com/singh1114/django-two-factor-auth","homepage":"http://example-two-factor-auth.herokuapp.com/","size":1077,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Bouke:master","ref":"master","sha":"e3265a531aa40f2a227e0e1aa81f607e0960ad76","user":{"login":"Bouke","id":235882,"node_id":"MDQ6VXNlcjIzNTg4Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/235882?v=4","gravatar_id":"","url":"https://api.github.com/users/Bouke","html_url":"https://github.com/Bouke","followers_url":"https://api.github.com/users/Bouke/followers","following_url":"https://api.github.com/users/Bouke/following{/other_user}","gists_url":"https://api.github.com/users/Bouke/gists{/gist_id}","starred_url":"https://api.github.com/users/Bouke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bouke/subscriptions","organizations_url":"https://api.github.com/users/Bouke/orgs","repos_url":"https://api.github.com/users/Bouke/repos","events_url":"https://api.github.com/users/Bouke/events{/privacy}","received_events_url":"https://api.github.com/users/Bouke/received_events","type":"User","site_admin":false},"repo":{"id":5765336,"node_id":"MDEwOlJlcG9zaXRvcnk1NzY1MzM2","name":"django-two-factor-auth","full_name":"Bouke/django-two-factor-auth","private":false,"owner":{"login":"Bouke","id":235882,"node_id":"MDQ6VXNlcjIzNTg4Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/235882?v=4","gravatar_id":"","url":"https://api.github.com/users/Bouke","html_url":"https://github.com/Bouke","followers_url":"https://api.github.com/users/Bouke/followers","following_url":"https://api.github.com/users/Bouke/following{/other_user}","gists_url":"https://api.github.com/users/Bouke/gists{/gist_id}","starred_url":"https://api.github.com/users/Bouke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bouke/subscriptions","organizations_url":"https://api.github.com/users/Bouke/orgs","repos_url":"https://api.github.com/users/Bouke/repos","events_url":"https://api.github.com/users/Bouke/events{/privacy}","received_events_url":"https://api.github.com/users/Bouke/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Bouke/django-two-factor-auth","description":"Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.","fork":false,"url":"https://api.github.com/repos/Bouke/django-two-factor-auth","forks_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/forks","keys_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/teams","hooks_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/hooks","issue_events_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/events{/number}","events_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/events","assignees_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/assignees{/user}","branches_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/branches{/branch}","tags_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/tags","blobs_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/languages","stargazers_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/stargazers","contributors_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/contributors","subscribers_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/subscribers","subscription_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/subscription","commits_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/contents/{+path}","compare_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/merges","archive_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/downloads","issues_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues{/number}","pulls_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/labels{/name}","releases_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/releases{/id}","deployments_url":"https://api.github.com/repos/Bouke/django-two-factor-auth/deployments","created_at":"2012-09-11T13:25:14Z","updated_at":"2018-11-07T09:44:26Z","pushed_at":"2018-11-12T19:40:32Z","git_url":"git://github.com/Bouke/django-two-factor-auth.git","ssh_url":"git@github.com:Bouke/django-two-factor-auth.git","clone_url":"https://github.com/Bouke/django-two-factor-auth.git","svn_url":"https://github.com/Bouke/django-two-factor-auth","homepage":"http://example-two-factor-auth.herokuapp.com/","size":1076,"stargazers_count":643,"watchers_count":643,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":211,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":211,"open_issues":45,"watchers":643,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284"},"html":{"href":"https://github.com/Bouke/django-two-factor-auth/pull/284"},"issue":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/284"},"comments":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/issues/284/comments"},"review_comments":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284/comments"},"review_comment":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/pulls/284/commits"},"statuses":{"href":"https://api.github.com/repos/Bouke/django-two-factor-auth/statuses/a56951efad8492f7d982c28f184573a1ab5075f5"}},"author_association":"NONE"}}
{"actor":{"display_login":"moggers87"}}