{"action":"created","comment":{"url":"https://api.github.com/repos/18F/identity-idp/pulls/comments/77753917","id":77753917,"diff_hunk":"@@ -53,12 +53,6 @@ def check_already_authenticated\n       redirect_to profile_path if user_fully_authenticated?\n     end\n \n-    def use_totp?\n-      # Present the TOTP entry screen to users who are TOTP enabled,\n-      # unless the user explictly selects SMS or voice\n-      current_user.totp_enabled? && !use_sms_or_voice_otp_delivery?\n-    end","path":"app/controllers/devise/two_factor_authentication_controller.rb","position":17,"original_position":17,"commit_id":"ddb5fd7a1d994e7a4f5ade000b7635c0a0bf9589","original_commit_id":"ddb5fd7a1d994e7a4f5ade000b7635c0a0bf9589","user":{"login":"monfresh","id":811150,"avatar_url":"https://avatars.githubusercontent.com/u/811150?v=3","gravatar_id":"","url":"https://api.github.com/users/monfresh","html_url":"https://github.com/monfresh","followers_url":"https://api.github.com/users/monfresh/followers","following_url":"https://api.github.com/users/monfresh/following{/other_user}","gists_url":"https://api.github.com/users/monfresh/gists{/gist_id}","starred_url":"https://api.github.com/users/monfresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monfresh/subscriptions","organizations_url":"https://api.github.com/users/monfresh/orgs","repos_url":"https://api.github.com/users/monfresh/repos","events_url":"https://api.github.com/users/monfresh/events{/privacy}","received_events_url":"https://api.github.com/users/monfresh/received_events","type":"User","site_admin":false},"body":"I removed this because a TOTP-enabled user can never select any other option before they land on the `show` view, which is the only place this method was called. When a TOTP-enabled user signs in, they are automatically asked for their Authenticator app code, with the option to use SMS or voice instead. If they choose one of those options, they go to the `otp/send` path, which never calls this `use_totp?` method.","created_at":"2016-09-07T03:04:36Z","updated_at":"2016-09-07T03:04:36Z","html_url":"https://github.com/18F/identity-idp/pull/452#discussion_r77753917","pull_request_url":"https://api.github.com/repos/18F/identity-idp/pulls/452","_links":{"self":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/comments/77753917"},"html":{"href":"https://github.com/18F/identity-idp/pull/452#discussion_r77753917"},"pull_request":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/452"}}},"pull_request":{"url":"https://api.github.com/repos/18F/identity-idp/pulls/452","id":84227971,"html_url":"https://github.com/18F/identity-idp/pull/452","diff_url":"https://github.com/18F/identity-idp/pull/452.diff","patch_url":"https://github.com/18F/identity-idp/pull/452.patch","issue_url":"https://api.github.com/repos/18F/identity-idp/issues/452","number":452,"state":"open","locked":false,"title":"Make OTP delivery independent of 2FA gem","user":{"login":"monfresh","id":811150,"avatar_url":"https://avatars.githubusercontent.com/u/811150?v=3","gravatar_id":"","url":"https://api.github.com/users/monfresh","html_url":"https://github.com/monfresh","followers_url":"https://api.github.com/users/monfresh/followers","following_url":"https://api.github.com/users/monfresh/following{/other_user}","gists_url":"https://api.github.com/users/monfresh/gists{/gist_id}","starred_url":"https://api.github.com/users/monfresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monfresh/subscriptions","organizations_url":"https://api.github.com/users/monfresh/orgs","repos_url":"https://api.github.com/users/monfresh/repos","events_url":"https://api.github.com/users/monfresh/events{/privacy}","received_events_url":"https://api.github.com/users/monfresh/received_events","type":"User","site_admin":false},"body":"**Why**: We should not have to modify the\r\n`send_two_factor_authentication_code` method in the\r\n`two_factor_authentication` gem in order to accommodate multiple\r\ndelivery mechanisms. This violates the \"O\" in the SOLID object-oriented\r\ndesign principles. The \"O\" stands for Open for extension, Closed\r\nfor modification.\r\n\r\n**How**:\r\nWe can work around the gem's undesirable design choices by making a few\r\nsensible changes:\r\n\r\n- Make the `send_two_factor_authentication_code` method a no-op method,\r\ni.e. it doesn't do anything. This means that even though the gem calls\r\nthis method right after Warden signs the user in, nothing will happen,\r\nwhich is what we want.\r\n\r\n- Instead of relying on the `send_two_factor_authentication_code`\r\nmethod and the `UserOtpSender` class to invoke the proper background\r\njob, we do this work in the controller, and use the delivery method\r\nchosen by the user to determine which job to invoke.\r\n\r\nThis allows us to continue our work without having to fork the gem or\r\nwait for our PRs to be approved and merged. We can work on our code\r\nthe way we want and propose changes to the gem in parallel, without\r\none depending on the other.\r\n\r\nNote that these are the smallest changes I could come up with to remove\r\nthe dependency on Amos's fork, without changing behavior. Due to\r\npreexisting duplication, new duplication was introduced, but it will be\r\ncleaned up in subsequent PRs, which are part of a larger refactor I am\r\nworking on.","created_at":"2016-09-07T02:38:05Z","updated_at":"2016-09-07T03:04:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c27c360755d33a40b6f975d1322a82da47af4ba2","assignee":{"login":"amoose","id":1328699,"avatar_url":"https://avatars.githubusercontent.com/u/1328699?v=3","gravatar_id":"","url":"https://api.github.com/users/amoose","html_url":"https://github.com/amoose","followers_url":"https://api.github.com/users/amoose/followers","following_url":"https://api.github.com/users/amoose/following{/other_user}","gists_url":"https://api.github.com/users/amoose/gists{/gist_id}","starred_url":"https://api.github.com/users/amoose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoose/subscriptions","organizations_url":"https://api.github.com/users/amoose/orgs","repos_url":"https://api.github.com/users/amoose/repos","events_url":"https://api.github.com/users/amoose/events{/privacy}","received_events_url":"https://api.github.com/users/amoose/received_events","type":"User","site_admin":false},"assignees":[{"login":"amoose","id":1328699,"avatar_url":"https://avatars.githubusercontent.com/u/1328699?v=3","gravatar_id":"","url":"https://api.github.com/users/amoose","html_url":"https://github.com/amoose","followers_url":"https://api.github.com/users/amoose/followers","following_url":"https://api.github.com/users/amoose/following{/other_user}","gists_url":"https://api.github.com/users/amoose/gists{/gist_id}","starred_url":"https://api.github.com/users/amoose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoose/subscriptions","organizations_url":"https://api.github.com/users/amoose/orgs","repos_url":"https://api.github.com/users/amoose/repos","events_url":"https://api.github.com/users/amoose/events{/privacy}","received_events_url":"https://api.github.com/users/amoose/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/18F/identity-idp/pulls/452/commits","review_comments_url":"https://api.github.com/repos/18F/identity-idp/pulls/452/comments","review_comment_url":"https://api.github.com/repos/18F/identity-idp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/18F/identity-idp/issues/452/comments","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/ddb5fd7a1d994e7a4f5ade000b7635c0a0bf9589","head":{"label":"18F:refactor-otp-delivery","ref":"refactor-otp-delivery","sha":"ddb5fd7a1d994e7a4f5ade000b7635c0a0bf9589","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":50386243,"name":"identity-idp","full_name":"18F/identity-idp","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/identity-idp","description":"18f PoC Identity Provider (IdP)","fork":false,"url":"https://api.github.com/repos/18F/identity-idp","forks_url":"https://api.github.com/repos/18F/identity-idp/forks","keys_url":"https://api.github.com/repos/18F/identity-idp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/identity-idp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/identity-idp/teams","hooks_url":"https://api.github.com/repos/18F/identity-idp/hooks","issue_events_url":"https://api.github.com/repos/18F/identity-idp/issues/events{/number}","events_url":"https://api.github.com/repos/18F/identity-idp/events","assignees_url":"https://api.github.com/repos/18F/identity-idp/assignees{/user}","branches_url":"https://api.github.com/repos/18F/identity-idp/branches{/branch}","tags_url":"https://api.github.com/repos/18F/identity-idp/tags","blobs_url":"https://api.github.com/repos/18F/identity-idp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/identity-idp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/identity-idp/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/identity-idp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/identity-idp/languages","stargazers_url":"https://api.github.com/repos/18F/identity-idp/stargazers","contributors_url":"https://api.github.com/repos/18F/identity-idp/contributors","subscribers_url":"https://api.github.com/repos/18F/identity-idp/subscribers","subscription_url":"https://api.github.com/repos/18F/identity-idp/subscription","commits_url":"https://api.github.com/repos/18F/identity-idp/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/identity-idp/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/identity-idp/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/identity-idp/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/identity-idp/contents/{+path}","compare_url":"https://api.github.com/repos/18F/identity-idp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/identity-idp/merges","archive_url":"https://api.github.com/repos/18F/identity-idp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/identity-idp/downloads","issues_url":"https://api.github.com/repos/18F/identity-idp/issues{/number}","pulls_url":"https://api.github.com/repos/18F/identity-idp/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/identity-idp/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/identity-idp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/identity-idp/labels{/name}","releases_url":"https://api.github.com/repos/18F/identity-idp/releases{/id}","deployments_url":"https://api.github.com/repos/18F/identity-idp/deployments","created_at":"2016-01-25T22:40:59Z","updated_at":"2016-08-20T03:57:40Z","pushed_at":"2016-09-07T02:50:52Z","git_url":"git://github.com/18F/identity-idp.git","ssh_url":"git@github.com:18F/identity-idp.git","clone_url":"https://github.com/18F/identity-idp.git","svn_url":"https://github.com/18F/identity-idp","homepage":"https://idp.demo.login.gov/","size":9500,"stargazers_count":21,"watchers_count":21,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":21,"default_branch":"master"}},"base":{"label":"18F:master","ref":"master","sha":"69d26f22a6d6dbcab486b712e11cd7e0a71ff2cd","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":50386243,"name":"identity-idp","full_name":"18F/identity-idp","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/identity-idp","description":"18f PoC Identity Provider (IdP)","fork":false,"url":"https://api.github.com/repos/18F/identity-idp","forks_url":"https://api.github.com/repos/18F/identity-idp/forks","keys_url":"https://api.github.com/repos/18F/identity-idp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/identity-idp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/identity-idp/teams","hooks_url":"https://api.github.com/repos/18F/identity-idp/hooks","issue_events_url":"https://api.github.com/repos/18F/identity-idp/issues/events{/number}","events_url":"https://api.github.com/repos/18F/identity-idp/events","assignees_url":"https://api.github.com/repos/18F/identity-idp/assignees{/user}","branches_url":"https://api.github.com/repos/18F/identity-idp/branches{/branch}","tags_url":"https://api.github.com/repos/18F/identity-idp/tags","blobs_url":"https://api.github.com/repos/18F/identity-idp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/identity-idp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/identity-idp/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/identity-idp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/identity-idp/languages","stargazers_url":"https://api.github.com/repos/18F/identity-idp/stargazers","contributors_url":"https://api.github.com/repos/18F/identity-idp/contributors","subscribers_url":"https://api.github.com/repos/18F/identity-idp/subscribers","subscription_url":"https://api.github.com/repos/18F/identity-idp/subscription","commits_url":"https://api.github.com/repos/18F/identity-idp/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/identity-idp/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/identity-idp/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/identity-idp/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/identity-idp/contents/{+path}","compare_url":"https://api.github.com/repos/18F/identity-idp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/identity-idp/merges","archive_url":"https://api.github.com/repos/18F/identity-idp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/identity-idp/downloads","issues_url":"https://api.github.com/repos/18F/identity-idp/issues{/number}","pulls_url":"https://api.github.com/repos/18F/identity-idp/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/identity-idp/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/identity-idp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/identity-idp/labels{/name}","releases_url":"https://api.github.com/repos/18F/identity-idp/releases{/id}","deployments_url":"https://api.github.com/repos/18F/identity-idp/deployments","created_at":"2016-01-25T22:40:59Z","updated_at":"2016-08-20T03:57:40Z","pushed_at":"2016-09-07T02:50:52Z","git_url":"git://github.com/18F/identity-idp.git","ssh_url":"git@github.com:18F/identity-idp.git","clone_url":"https://github.com/18F/identity-idp.git","svn_url":"https://github.com/18F/identity-idp","homepage":"https://idp.demo.login.gov/","size":9500,"stargazers_count":21,"watchers_count":21,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/452"},"html":{"href":"https://github.com/18F/identity-idp/pull/452"},"issue":{"href":"https://api.github.com/repos/18F/identity-idp/issues/452"},"comments":{"href":"https://api.github.com/repos/18F/identity-idp/issues/452/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/452/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/452/commits"},"statuses":{"href":"https://api.github.com/repos/18F/identity-idp/statuses/ddb5fd7a1d994e7a4f5ade000b7635c0a0bf9589"}}}}
{"actor":{"display_login":"monfresh"}}