{"action":"opened","number":61,"pull_request":{"url":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61","id":54418302,"html_url":"https://github.com/Houdini/two_factor_authentication/pull/61","diff_url":"https://github.com/Houdini/two_factor_authentication/pull/61.diff","patch_url":"https://github.com/Houdini/two_factor_authentication/pull/61.patch","issue_url":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/61","number":61,"state":"open","locked":false,"title":"Allow executing code after sign in and before sign out","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**\r\nIn some cases, it might be necessary to run some code right after the user signs in, but before the OTP is sent, and also right before a user signs out.\r\n\r\nFor example, consider this scenario:\r\n- The app requires the user to confirm their phone number before it gets saved. This confirmation is done by sending an OTP to the phone and asking the user to enter it.\r\n- User mistypes the number, then closes the anonymous browser window, or signs out before confirming\r\n- User signs back in, and OTP is sent to the mistyped number. User is now unable to fully sign in since the OTP is being sent to the wrong number\r\n\r\nIn order to prevent this scenario, we need to be able to reset the `unconfirmed_mobile` to nil before the OTP is sent, and before they sign out so that they can type it in again.\r\n\r\n**How**\r\nAllow the gem user to define an OtpSender class with a `reset_otp_state` method","created_at":"2015-12-22T21:43:06Z","updated_at":"2015-12-22T21:43:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61/commits","review_comments_url":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61/comments","review_comment_url":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/61/comments","statuses_url":"https://api.github.com/repos/Houdini/two_factor_authentication/statuses/6ed0d258998bd86f3aa9f70e1d50974b16b9f64e","head":{"label":"monfresh:customize-tfa-hook","ref":"customize-tfa-hook","sha":"6ed0d258998bd86f3aa9f70e1d50974b16b9f64e","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},"repo":{"id":30788399,"name":"two_factor_authentication","full_name":"monfresh/two_factor_authentication","owner":{"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},"private":false,"html_url":"https://github.com/monfresh/two_factor_authentication","description":"Two factor authentication extension for Devise","fork":true,"url":"https://api.github.com/repos/monfresh/two_factor_authentication","forks_url":"https://api.github.com/repos/monfresh/two_factor_authentication/forks","keys_url":"https://api.github.com/repos/monfresh/two_factor_authentication/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monfresh/two_factor_authentication/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monfresh/two_factor_authentication/teams","hooks_url":"https://api.github.com/repos/monfresh/two_factor_authentication/hooks","issue_events_url":"https://api.github.com/repos/monfresh/two_factor_authentication/issues/events{/number}","events_url":"https://api.github.com/repos/monfresh/two_factor_authentication/events","assignees_url":"https://api.github.com/repos/monfresh/two_factor_authentication/assignees{/user}","branches_url":"https://api.github.com/repos/monfresh/two_factor_authentication/branches{/branch}","tags_url":"https://api.github.com/repos/monfresh/two_factor_authentication/tags","blobs_url":"https://api.github.com/repos/monfresh/two_factor_authentication/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monfresh/two_factor_authentication/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monfresh/two_factor_authentication/git/refs{/sha}","trees_url":"https://api.github.com/repos/monfresh/two_factor_authentication/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monfresh/two_factor_authentication/statuses/{sha}","languages_url":"https://api.github.com/repos/monfresh/two_factor_authentication/languages","stargazers_url":"https://api.github.com/repos/monfresh/two_factor_authentication/stargazers","contributors_url":"https://api.github.com/repos/monfresh/two_factor_authentication/contributors","subscribers_url":"https://api.github.com/repos/monfresh/two_factor_authentication/subscribers","subscription_url":"https://api.github.com/repos/monfresh/two_factor_authentication/subscription","commits_url":"https://api.github.com/repos/monfresh/two_factor_authentication/commits{/sha}","git_commits_url":"https://api.github.com/repos/monfresh/two_factor_authentication/git/commits{/sha}","comments_url":"https://api.github.com/repos/monfresh/two_factor_authentication/comments{/number}","issue_comment_url":"https://api.github.com/repos/monfresh/two_factor_authentication/issues/comments{/number}","contents_url":"https://api.github.com/repos/monfresh/two_factor_authentication/contents/{+path}","compare_url":"https://api.github.com/repos/monfresh/two_factor_authentication/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monfresh/two_factor_authentication/merges","archive_url":"https://api.github.com/repos/monfresh/two_factor_authentication/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monfresh/two_factor_authentication/downloads","issues_url":"https://api.github.com/repos/monfresh/two_factor_authentication/issues{/number}","pulls_url":"https://api.github.com/repos/monfresh/two_factor_authentication/pulls{/number}","milestones_url":"https://api.github.com/repos/monfresh/two_factor_authentication/milestones{/number}","notifications_url":"https://api.github.com/repos/monfresh/two_factor_authentication/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monfresh/two_factor_authentication/labels{/name}","releases_url":"https://api.github.com/repos/monfresh/two_factor_authentication/releases{/id}","created_at":"2015-02-14T05:45:00Z","updated_at":"2015-02-14T05:45:00Z","pushed_at":"2015-12-22T21:34:40Z","git_url":"git://github.com/monfresh/two_factor_authentication.git","ssh_url":"git@github.com:monfresh/two_factor_authentication.git","clone_url":"https://github.com/monfresh/two_factor_authentication.git","svn_url":"https://github.com/monfresh/two_factor_authentication","homepage":"","size":129,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Houdini:master","ref":"master","sha":"6c4927dd6b6ab7d5fd9dd8528ecc482a3254db3a","user":{"login":"Houdini","id":17762,"avatar_url":"https://avatars.githubusercontent.com/u/17762?v=3","gravatar_id":"","url":"https://api.github.com/users/Houdini","html_url":"https://github.com/Houdini","followers_url":"https://api.github.com/users/Houdini/followers","following_url":"https://api.github.com/users/Houdini/following{/other_user}","gists_url":"https://api.github.com/users/Houdini/gists{/gist_id}","starred_url":"https://api.github.com/users/Houdini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Houdini/subscriptions","organizations_url":"https://api.github.com/users/Houdini/orgs","repos_url":"https://api.github.com/users/Houdini/repos","events_url":"https://api.github.com/users/Houdini/events{/privacy}","received_events_url":"https://api.github.com/users/Houdini/received_events","type":"User","site_admin":false},"repo":{"id":3311359,"name":"two_factor_authentication","full_name":"Houdini/two_factor_authentication","owner":{"login":"Houdini","id":17762,"avatar_url":"https://avatars.githubusercontent.com/u/17762?v=3","gravatar_id":"","url":"https://api.github.com/users/Houdini","html_url":"https://github.com/Houdini","followers_url":"https://api.github.com/users/Houdini/followers","following_url":"https://api.github.com/users/Houdini/following{/other_user}","gists_url":"https://api.github.com/users/Houdini/gists{/gist_id}","starred_url":"https://api.github.com/users/Houdini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Houdini/subscriptions","organizations_url":"https://api.github.com/users/Houdini/orgs","repos_url":"https://api.github.com/users/Houdini/repos","events_url":"https://api.github.com/users/Houdini/events{/privacy}","received_events_url":"https://api.github.com/users/Houdini/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Houdini/two_factor_authentication","description":"Two factor authentication extension for Devise","fork":false,"url":"https://api.github.com/repos/Houdini/two_factor_authentication","forks_url":"https://api.github.com/repos/Houdini/two_factor_authentication/forks","keys_url":"https://api.github.com/repos/Houdini/two_factor_authentication/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Houdini/two_factor_authentication/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Houdini/two_factor_authentication/teams","hooks_url":"https://api.github.com/repos/Houdini/two_factor_authentication/hooks","issue_events_url":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/events{/number}","events_url":"https://api.github.com/repos/Houdini/two_factor_authentication/events","assignees_url":"https://api.github.com/repos/Houdini/two_factor_authentication/assignees{/user}","branches_url":"https://api.github.com/repos/Houdini/two_factor_authentication/branches{/branch}","tags_url":"https://api.github.com/repos/Houdini/two_factor_authentication/tags","blobs_url":"https://api.github.com/repos/Houdini/two_factor_authentication/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Houdini/two_factor_authentication/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Houdini/two_factor_authentication/git/refs{/sha}","trees_url":"https://api.github.com/repos/Houdini/two_factor_authentication/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Houdini/two_factor_authentication/statuses/{sha}","languages_url":"https://api.github.com/repos/Houdini/two_factor_authentication/languages","stargazers_url":"https://api.github.com/repos/Houdini/two_factor_authentication/stargazers","contributors_url":"https://api.github.com/repos/Houdini/two_factor_authentication/contributors","subscribers_url":"https://api.github.com/repos/Houdini/two_factor_authentication/subscribers","subscription_url":"https://api.github.com/repos/Houdini/two_factor_authentication/subscription","commits_url":"https://api.github.com/repos/Houdini/two_factor_authentication/commits{/sha}","git_commits_url":"https://api.github.com/repos/Houdini/two_factor_authentication/git/commits{/sha}","comments_url":"https://api.github.com/repos/Houdini/two_factor_authentication/comments{/number}","issue_comment_url":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/comments{/number}","contents_url":"https://api.github.com/repos/Houdini/two_factor_authentication/contents/{+path}","compare_url":"https://api.github.com/repos/Houdini/two_factor_authentication/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Houdini/two_factor_authentication/merges","archive_url":"https://api.github.com/repos/Houdini/two_factor_authentication/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Houdini/two_factor_authentication/downloads","issues_url":"https://api.github.com/repos/Houdini/two_factor_authentication/issues{/number}","pulls_url":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls{/number}","milestones_url":"https://api.github.com/repos/Houdini/two_factor_authentication/milestones{/number}","notifications_url":"https://api.github.com/repos/Houdini/two_factor_authentication/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Houdini/two_factor_authentication/labels{/name}","releases_url":"https://api.github.com/repos/Houdini/two_factor_authentication/releases{/id}","created_at":"2012-01-31T02:58:19Z","updated_at":"2015-12-16T16:10:51Z","pushed_at":"2015-12-22T16:52:10Z","git_url":"git://github.com/Houdini/two_factor_authentication.git","ssh_url":"git@github.com:Houdini/two_factor_authentication.git","clone_url":"https://github.com/Houdini/two_factor_authentication.git","svn_url":"https://github.com/Houdini/two_factor_authentication","homepage":"","size":139,"stargazers_count":156,"watchers_count":156,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":65,"mirror_url":null,"open_issues_count":11,"forks":65,"open_issues":11,"watchers":156,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61"},"html":{"href":"https://github.com/Houdini/two_factor_authentication/pull/61"},"issue":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/61"},"comments":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/Houdini/two_factor_authentication/statuses/6ed0d258998bd86f3aa9f70e1d50974b16b9f64e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":90,"deletions":1,"changed_files":4}}