{"action":"created","comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments/33805269","id":33805269,"diff_hunk":"@@ -0,0 +1,24 @@\n+#import <Foundation/Foundation.h>\n+\n+typedef void(^WPAuthTokenissueSolverCompletionBlock)();","path":"WordPress/Classes/Utility/WPAuthTokenIssueSolver.h","position":3,"original_position":3,"commit_id":"a2a96b2faeb75180d8569709ac8482e0433a6725","original_commit_id":"78e2990f0baeb63ebe53548343bb107bdf22e3b4","user":{"login":"sendhil","id":437043,"avatar_url":"https://avatars.githubusercontent.com/u/437043?v=3","gravatar_id":"","url":"https://api.github.com/users/sendhil","html_url":"https://github.com/sendhil","followers_url":"https://api.github.com/users/sendhil/followers","following_url":"https://api.github.com/users/sendhil/following{/other_user}","gists_url":"https://api.github.com/users/sendhil/gists{/gist_id}","starred_url":"https://api.github.com/users/sendhil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendhil/subscriptions","organizations_url":"https://api.github.com/users/sendhil/orgs","repos_url":"https://api.github.com/users/sendhil/repos","events_url":"https://api.github.com/users/sendhil/events{/privacy}","received_events_url":"https://api.github.com/users/sendhil/received_events","type":"User","site_admin":false},"body":"Little nitpick, probably want to capitalize the `i` in `issue` so it's `WPAuthTokenIssueSolverCompletionBlock`","created_at":"2015-07-02T18:03:40Z","updated_at":"2015-07-02T18:03:40Z","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967#discussion_r33805269","pull_request_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967","_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments/33805269"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967#discussion_r33805269"},"pull_request":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967"}}},"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967","id":39052397,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967","diff_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967.patch","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3967","number":3967,"state":"open","locked":false,"title":"Auth token issues solver. [DO NOT MERGE]","user":{"login":"diegoreymendez","id":1836005,"avatar_url":"https://avatars.githubusercontent.com/u/1836005?v=3","gravatar_id":"","url":"https://api.github.com/users/diegoreymendez","html_url":"https://github.com/diegoreymendez","followers_url":"https://api.github.com/users/diegoreymendez/followers","following_url":"https://api.github.com/users/diegoreymendez/following{/other_user}","gists_url":"https://api.github.com/users/diegoreymendez/gists{/gist_id}","starred_url":"https://api.github.com/users/diegoreymendez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diegoreymendez/subscriptions","organizations_url":"https://api.github.com/users/diegoreymendez/orgs","repos_url":"https://api.github.com/users/diegoreymendez/repos","events_url":"https://api.github.com/users/diegoreymendez/events{/privacy}","received_events_url":"https://api.github.com/users/diegoreymendez/received_events","type":"User","site_admin":false},"body":"Takes care points 3, 4 and 5 from [this issue](https://github.com/wordpress-mobile/WordPress-iOS/issues/3964) reported by @astralbodies.\r\n\r\nThis should NOT be merged until [this PR](https://github.com/wordpress-mobile/WordPress-iOS/pull/3956) by @astralbodies is merged.  The reason is that this PR is a branch from that PR.\r\n\r\nPlease keep in mind this is a hotfix, so even though some code has been moved, as little as possible of the existing logic has been really modified.  This means there's some code duplication.\r\n\r\n**Test 1:**\r\n- Comment out method `setUsername:` in `WPAccount`\r\n- Login with a mixed case WP.com username name or a WP.com email address\r\n- Create post, quit app without hitting the save button\r\n- Reopen the app, it should ask you to re-authenticate (if you disabled the method above)\r\n- Re-authenticate\r\n- Make sure your post is still there\r\n\r\n**Test 2:**\r\n- Comment out method `setUsername:` in `WPAccount`\r\n- Login with a mixed case WP.com username name or a WP.com email address\r\n- Go to the site picker and add self-hosted blog\r\n- Quit the app normally\r\n- Reopen the app, it should ask you to re-authenticate (if you disabled the method above)\r\n- Hit cancel instead of re-authing\r\n- A warning will ask if you want to delete your local wp.com data\r\n- Delete it\r\n- Make sure the self hosted blog is still there, but that the wp.com related data has been removed (such as all wp.com blogs from the site picker).\r\n\r\n**Test 3:**\r\n- Re-enable method `setUsername:` in `WPAccount`\r\n- Login with either email or mixed cap username\r\n- Quit app, reopen\r\n- Should log in normally, without issues\r\n\r\n**Test 4:** \r\n- Comment out method `setUsername:` in `WPAccount`\r\n- Login with a mixed case WP.com username name or a WP.com email address\r\n- Quit the app normally\r\n- Reopen the app, it should ask you to re-authenticate (if you disabled the method above)\r\n- Try logging-in with a bad password.\r\n- Make sure you can interact with the overlay that comes up, and dismiss it by pressing \"OK\".\r\n\r\n**Test 5:**\r\n- Make sure to repeat all previous tests for different iOS versions.\r\n\r\n**Discussion:** (please take a moment to read and provide feedback)\r\n- We don't currently have any procedure to make sure the user re-authenticates with the same user he was using previously, which seems a bit dangerous to me not to have.  This feels like something doable, but completely outside of the scope of a simple hot-fix (especially a nightly hot-fix like this one).  We could enhance `LoginViewController` with code to check that `account.userId` matches the remote info returned by the new authentication attempt.\r\n- I believe we could improve this PR **drastically* by adding an automatic recovery attempt.  I've reviewed the keychain code we have and it supports case insensitive searches and returning multiple results.  If the auth token is `nil` we could try to (case-insensitively) search the keychain for all `account.username` and `account.email` matches, then try logging in with the returned authTokens and, on success, confirming that our locally stored `account.userId` matches the account data returned by the services (in order to make sure we're logging into the right account).  If the automatic attempt fails we can fall back into this code.","created_at":"2015-07-02T06:42:43Z","updated_at":"2015-07-02T18:03:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59eae9558ca26999d694270078da7a9ea404f97b","assignee":null,"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/42","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/milestones/5.3","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/42/labels","id":1108513,"number":42,"title":"5.3","description":"","creator":{"login":"jleandroperez","id":1195260,"avatar_url":"https://avatars.githubusercontent.com/u/1195260?v=3","gravatar_id":"","url":"https://api.github.com/users/jleandroperez","html_url":"https://github.com/jleandroperez","followers_url":"https://api.github.com/users/jleandroperez/followers","following_url":"https://api.github.com/users/jleandroperez/following{/other_user}","gists_url":"https://api.github.com/users/jleandroperez/gists{/gist_id}","starred_url":"https://api.github.com/users/jleandroperez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jleandroperez/subscriptions","organizations_url":"https://api.github.com/users/jleandroperez/orgs","repos_url":"https://api.github.com/users/jleandroperez/repos","events_url":"https://api.github.com/users/jleandroperez/events{/privacy}","received_events_url":"https://api.github.com/users/jleandroperez/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":131,"state":"open","created_at":"2015-05-13T12:39:07Z","updated_at":"2015-07-02T06:43:52Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967/commits","review_comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967/comments","review_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3967/comments","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/a2a96b2faeb75180d8569709ac8482e0433a6725","head":{"label":"wordpress-mobile:issue/3964-token-storage","ref":"issue/3964-token-storage","sha":"a2a96b2faeb75180d8569709ac8482e0433a6725","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":8859285,"name":"WordPress-iOS","full_name":"wordpress-mobile/WordPress-iOS","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS","description":"WordPress for iOS - Official repository","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/releases{/id}","created_at":"2013-03-18T16:59:33Z","updated_at":"2015-07-02T15:19:53Z","pushed_at":"2015-07-02T17:33:57Z","git_url":"git://github.com/wordpress-mobile/WordPress-iOS.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-iOS.git","clone_url":"https://github.com/wordpress-mobile/WordPress-iOS.git","svn_url":"https://github.com/wordpress-mobile/WordPress-iOS","homepage":"http://ios.wordpress.org/","size":392147,"stargazers_count":638,"watchers_count":638,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":318,"mirror_url":null,"open_issues_count":346,"forks":318,"open_issues":346,"watchers":638,"default_branch":"develop"}},"base":{"label":"wordpress-mobile:release/5.3.1","ref":"release/5.3.1","sha":"f9003f0631b275d8db560763fc0c69cacbcdf7dc","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":8859285,"name":"WordPress-iOS","full_name":"wordpress-mobile/WordPress-iOS","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS","description":"WordPress for iOS - Official repository","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/releases{/id}","created_at":"2013-03-18T16:59:33Z","updated_at":"2015-07-02T15:19:53Z","pushed_at":"2015-07-02T17:33:57Z","git_url":"git://github.com/wordpress-mobile/WordPress-iOS.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-iOS.git","clone_url":"https://github.com/wordpress-mobile/WordPress-iOS.git","svn_url":"https://github.com/wordpress-mobile/WordPress-iOS","homepage":"http://ios.wordpress.org/","size":392147,"stargazers_count":638,"watchers_count":638,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":318,"mirror_url":null,"open_issues_count":346,"forks":318,"open_issues":346,"watchers":638,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3967"},"issue":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3967"},"comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3967/comments"},"review_comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967/comments"},"review_comment":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3967/commits"},"statuses":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/a2a96b2faeb75180d8569709ac8482e0433a6725"}}}}