{"action":"created","comment":{"url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments/32020614","id":32020614,"diff_hunk":"@@ -101,20 +119,17 @@ def _get_keyboard_input(self, label, default_value=\"\"):\n             user_input = raw_input(text) or default_value\n         return user_input\n \n-    def _get_session_token(self, hostname, login, password, http_proxy):\n+    def _get_2fa_code(self):\n         \"\"\"\n-        Retrieves a session token for the given credentials. If it fails, the user is informed\n-        :param hostname: The host to connect to.\n-        :param login: The user to get a session for.\n-        :param password: Password for the user.\n-        :param http_proxy: Proxy to use. Can be None.\n-        :returns: If the credentials were valid, returns a session token, otherwise returns None.\n+        Prompts the user for his 2fa code.\n+        :returns: Two factor authentication code.\n+        :raises AuthenticationCancelled: If the user enters an empty code, the exception will be\n+                                         thrown.\n         \"\"\"\n-        try:\n-            return session_cache.generate_session_token(hostname, login, password, http_proxy)\n-        except AuthenticationError:\n-            print \"Login failed.\"\n-            return None\n+        code = raw_input(\"Code (empty to abort): \")","path":"python/tank_vendor/shotgun_authentication/console_authentication.py","position":72,"original_position":72,"commit_id":"3678b9b2477f71fa22da7a761ef9b9eb51204885","original_commit_id":"3678b9b2477f71fa22da7a761ef9b9eb51204885","user":{"login":"jfboismenu-adsk","id":8126447,"avatar_url":"https://avatars.githubusercontent.com/u/8126447?v=3","gravatar_id":"","url":"https://api.github.com/users/jfboismenu-adsk","html_url":"https://github.com/jfboismenu-adsk","followers_url":"https://api.github.com/users/jfboismenu-adsk/followers","following_url":"https://api.github.com/users/jfboismenu-adsk/following{/other_user}","gists_url":"https://api.github.com/users/jfboismenu-adsk/gists{/gist_id}","starred_url":"https://api.github.com/users/jfboismenu-adsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfboismenu-adsk/subscriptions","organizations_url":"https://api.github.com/users/jfboismenu-adsk/orgs","repos_url":"https://api.github.com/users/jfboismenu-adsk/repos","events_url":"https://api.github.com/users/jfboismenu-adsk/events{/privacy}","received_events_url":"https://api.github.com/users/jfboismenu-adsk/received_events","type":"User","site_admin":false},"body":"This feels like a bit too blocky. It's harder to know what's going on and where you are supposed to look at.\r\n![screen shot 2015-06-09 at 10 44 43 am](https://cloud.githubusercontent.com/assets/8126447/8060701/c31526a4-0e94-11e5-90a3-713139a47361.png)\r\nThis makes it unnecessarily long:\r\n![screen shot 2015-06-09 at 10 44 32 am](https://cloud.githubusercontent.com/assets/8126447/8060723/e59054ec-0e94-11e5-9b0b-9eebee00a2c3.png)\r\nI feel like a compromise between the two is the best:\r\n![screen shot 2015-06-09 at 10 36 25 am](https://cloud.githubusercontent.com/assets/8126447/8060735/f7f071da-0e94-11e5-822a-93d396990203.png)\r\nWhat do you think?","created_at":"2015-06-09T14:48:26Z","updated_at":"2015-06-09T14:48:26Z","html_url":"https://github.com/shotgunsoftware/tk-core/pull/173#discussion_r32020614","pull_request_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173","_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments/32020614"},"html":{"href":"https://github.com/shotgunsoftware/tk-core/pull/173#discussion_r32020614"},"pull_request":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173"}}},"pull_request":{"url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173","id":37187789,"html_url":"https://github.com/shotgunsoftware/tk-core/pull/173","diff_url":"https://github.com/shotgunsoftware/tk-core/pull/173.diff","patch_url":"https://github.com/shotgunsoftware/tk-core/pull/173.patch","issue_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/173","number":173,"state":"open","locked":false,"title":"For #28904, implements two factor authentication","user":{"login":"jfboismenu-adsk","id":8126447,"avatar_url":"https://avatars.githubusercontent.com/u/8126447?v=3","gravatar_id":"","url":"https://api.github.com/users/jfboismenu-adsk","html_url":"https://github.com/jfboismenu-adsk","followers_url":"https://api.github.com/users/jfboismenu-adsk/followers","following_url":"https://api.github.com/users/jfboismenu-adsk/following{/other_user}","gists_url":"https://api.github.com/users/jfboismenu-adsk/gists{/gist_id}","starred_url":"https://api.github.com/users/jfboismenu-adsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfboismenu-adsk/subscriptions","organizations_url":"https://api.github.com/users/jfboismenu-adsk/orgs","repos_url":"https://api.github.com/users/jfboismenu-adsk/repos","events_url":"https://api.github.com/users/jfboismenu-adsk/events{/privacy}","received_events_url":"https://api.github.com/users/jfboismenu-adsk/received_events","type":"User","site_admin":false},"body":"Implements two factor authentication in Toolkit, both for UI based and console based login.\r\nHere's  the login dialog:\r\n![screen shot 2015-06-08 at 3 37 09 pm](https://cloud.githubusercontent.com/assets/8126447/8043456/57c9cbac-0df4-11e5-8d19-8d5f58931b1d.png)\r\nHere's the 2fa dialog:\r\n![screen shot 2015-06-08 at 3 37 15 pm](https://cloud.githubusercontent.com/assets/8126447/8043464/62783bf6-0df4-11e5-9f56-18797a8c1015.png)\r\nHere's the backup codes dialog:\r\n![screen shot 2015-06-08 at 3 37 19 pm](https://cloud.githubusercontent.com/assets/8126447/8043472/6aa15bc8-0df4-11e5-8ccc-64c7b6593066.png)\r\n","created_at":"2015-06-08T19:36:08Z","updated_at":"2015-06-09T14:48:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9d93977260b6a5ef7356d1e652c4f0b82efe2f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173/commits","review_comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173/comments","review_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/173/comments","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/3678b9b2477f71fa22da7a761ef9b9eb51204885","head":{"label":"shotgunsoftware:28904_2fa","ref":"28904_2fa","sha":"3678b9b2477f71fa22da7a761ef9b9eb51204885","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4270061,"name":"tk-core","full_name":"shotgunsoftware/tk-core","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-core","description":"The Shotgun Pipeline Toolkit Core API","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-core","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-core/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-core/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-core/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-core/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-core/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-core/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-core/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-core/releases{/id}","created_at":"2012-05-09T09:12:06Z","updated_at":"2015-05-08T21:00:43Z","pushed_at":"2015-06-08T19:36:08Z","git_url":"git://github.com/shotgunsoftware/tk-core.git","ssh_url":"git@github.com:shotgunsoftware/tk-core.git","clone_url":"https://github.com/shotgunsoftware/tk-core.git","svn_url":"https://github.com/shotgunsoftware/tk-core","homepage":"","size":43746,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":14,"forks":14,"open_issues":14,"watchers":18,"default_branch":"master"}},"base":{"label":"shotgunsoftware:master","ref":"master","sha":"96a7e8e9feaaba716162542f92d98ab128dc9dc1","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4270061,"name":"tk-core","full_name":"shotgunsoftware/tk-core","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-core","description":"The Shotgun Pipeline Toolkit Core API","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-core","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-core/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-core/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-core/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-core/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-core/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-core/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-core/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-core/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-core/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-core/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-core/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-core/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-core/releases{/id}","created_at":"2012-05-09T09:12:06Z","updated_at":"2015-05-08T21:00:43Z","pushed_at":"2015-06-08T19:36:08Z","git_url":"git://github.com/shotgunsoftware/tk-core.git","ssh_url":"git@github.com:shotgunsoftware/tk-core.git","clone_url":"https://github.com/shotgunsoftware/tk-core.git","svn_url":"https://github.com/shotgunsoftware/tk-core","homepage":"","size":43746,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":14,"forks":14,"open_issues":14,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173"},"html":{"href":"https://github.com/shotgunsoftware/tk-core/pull/173"},"issue":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/173"},"comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/issues/173/comments"},"review_comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173/comments"},"review_comment":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/pulls/173/commits"},"statuses":{"href":"https://api.github.com/repos/shotgunsoftware/tk-core/statuses/3678b9b2477f71fa22da7a761ef9b9eb51204885"}}}}