{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/69025689","id":69025689,"diff_hunk":"@@ -220,8 +220,16 @@ public function login_body_class( $classes ) {\n \t\t//Always add the jetpack-sso class so that we can add SSO specific styling even when the SSO form isn't being displayed.\n \t\t$classes[] = 'jetpack-sso';\n \n-\t\t// If jetpack-sso-default-form, show the default login form.\n-\t\tif ( isset( $_GET['jetpack-sso-default-form'] ) && 1 == $_GET['jetpack-sso-default-form'] ) {\n+\t\t/**\n+\t\t * Should we show the default or SSO login form?\n+\t\t *\n+\t\t * $_GET['jetpack-sso-default-form'] is used to provide a fallback in case JavaScript is not enabled.\n+\t\t *\n+\t\t * The default_to_sso_login() method allows us to dynamically decide which type of login to show. The SSO module\n+\t\t * uses the method to display the default login form if we can not find a user to log in via SSO. But, the method\n+\t\t * could be filtered by a site admin to always show the default login form if that is preferred.\n+\t\t */\n+\t\tif ( ! empty( $_GET['jetpack-sso-default-form'] )  || ! Jetpack_SSO_Helpers::default_to_sso_login() ) {","path":"modules/sso.php","position":15,"original_position":15,"commit_id":"a733fe2b942927163d34ad79805f9b2226ae10e6","original_commit_id":"a733fe2b942927163d34ad79805f9b2226ae10e6","user":{"login":"enejb","id":115071,"avatar_url":"https://avatars.githubusercontent.com/u/115071?v=3","gravatar_id":"","url":"https://api.github.com/users/enejb","html_url":"https://github.com/enejb","followers_url":"https://api.github.com/users/enejb/followers","following_url":"https://api.github.com/users/enejb/following{/other_user}","gists_url":"https://api.github.com/users/enejb/gists{/gist_id}","starred_url":"https://api.github.com/users/enejb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enejb/subscriptions","organizations_url":"https://api.github.com/users/enejb/orgs","repos_url":"https://api.github.com/users/enejb/repos","events_url":"https://api.github.com/users/enejb/events{/privacy}","received_events_url":"https://api.github.com/users/enejb/received_events","type":"User","site_admin":false},"body":"Thanks for the comment above. \r\nI find this really hard to follow. I don't know if returning true here will display the default form or display the sso form. \r\nMy guess  is that if the statment is true that we should show the default form. \r\n\r\nI think to make it more clear we could do something like\r\n```\r\n$show_default_wp_login_form = ( isset( $_GET['jetpack-sso-default-form'] ) || ! Jetpack_SSO_Helpers::display_sso_login() )\r\nif ( $show_default_wp_login_form ) {\r\nreturn $classes;\r\n}\r\n```","created_at":"2016-06-29T20:54:24Z","updated_at":"2016-06-29T20:54:24Z","html_url":"https://github.com/Automattic/jetpack/pull/4252#discussion_r69025689","pull_request_url":"https://api.github.com/repos/Automattic/jetpack/pulls/4252","_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/69025689"},"html":{"href":"https://github.com/Automattic/jetpack/pull/4252#discussion_r69025689"},"pull_request":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/4252"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/4252","id":75716741,"html_url":"https://github.com/Automattic/jetpack/pull/4252","diff_url":"https://github.com/Automattic/jetpack/pull/4252.diff","patch_url":"https://github.com/Automattic/jetpack/pull/4252.patch","issue_url":"https://api.github.com/repos/Automattic/jetpack/issues/4252","number":4252,"state":"open","locked":false,"title":"SSO: Show default login form if we can not log user in with SSO","user":{"login":"ebinnion","id":1126811,"avatar_url":"https://avatars.githubusercontent.com/u/1126811?v=3","gravatar_id":"","url":"https://api.github.com/users/ebinnion","html_url":"https://github.com/ebinnion","followers_url":"https://api.github.com/users/ebinnion/followers","following_url":"https://api.github.com/users/ebinnion/following{/other_user}","gists_url":"https://api.github.com/users/ebinnion/gists{/gist_id}","starred_url":"https://api.github.com/users/ebinnion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebinnion/subscriptions","organizations_url":"https://api.github.com/users/ebinnion/orgs","repos_url":"https://api.github.com/users/ebinnion/repos","events_url":"https://api.github.com/users/ebinnion/events{/privacy}","received_events_url":"https://api.github.com/users/ebinnion/received_events","type":"User","site_admin":false},"body":"Currently, if a user attempts to log in via SSO, and for some reason we can't find a user to login, we simply show a notice and the SSO login form again.\r\n\r\n@rickybanister recently suggested that we show the default login form and then prompt the user (after logging in with Jetpack site credentials) to connect to WP.com. This is the first part of that flow.\r\n\r\nTo test:\r\n\r\n- Checkout `update/sso-show-default-cant-find-user` branch\r\n- Pick, or create, a test user on the remote site that is not connected to WP.com.\r\n- And then either:\r\n    1) Make sure the test user has an email that doesn't match the WP.com user's email\r\n    2) In a compatibility plugin: `add_filter( 'jetpack_sso_match_by_email', '__return_false') ;`\r\n- Go to `/wp-admin`\r\n- Click \"Log in with WordPress.com\" button\r\n- Approve the SSO process on WP.com\r\n- When you land back on your site, you should see the username and password fields (aka default login form)\r\n\r\n\r\nIf you'd like to test more:\r\n\r\n- In a compatibility plugin:\r\n    - `add_filter( 'jetpack_remove_login_form', '__return_true' );`\r\n- Follow same steps above to log in with WP.com\r\n- When you land back on your Jetpack site, you should see the SSO login form\r\n    - This is because we have disabled the default login form\r\n\r\ncc @rickybanister for a design/flow review. @lezama and @enejb for code review.","created_at":"2016-06-29T20:35:12Z","updated_at":"2016-06-29T20:54:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d5ccc6e4085b560e8321c2e74cae46835b937c1","assignee":{"login":"ebinnion","id":1126811,"avatar_url":"https://avatars.githubusercontent.com/u/1126811?v=3","gravatar_id":"","url":"https://api.github.com/users/ebinnion","html_url":"https://github.com/ebinnion","followers_url":"https://api.github.com/users/ebinnion/followers","following_url":"https://api.github.com/users/ebinnion/following{/other_user}","gists_url":"https://api.github.com/users/ebinnion/gists{/gist_id}","starred_url":"https://api.github.com/users/ebinnion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebinnion/subscriptions","organizations_url":"https://api.github.com/users/ebinnion/orgs","repos_url":"https://api.github.com/users/ebinnion/repos","events_url":"https://api.github.com/users/ebinnion/events{/privacy}","received_events_url":"https://api.github.com/users/ebinnion/received_events","type":"User","site_admin":false},"assignees":[{"login":"ebinnion","id":1126811,"avatar_url":"https://avatars.githubusercontent.com/u/1126811?v=3","gravatar_id":"","url":"https://api.github.com/users/ebinnion","html_url":"https://github.com/ebinnion","followers_url":"https://api.github.com/users/ebinnion/followers","following_url":"https://api.github.com/users/ebinnion/following{/other_user}","gists_url":"https://api.github.com/users/ebinnion/gists{/gist_id}","starred_url":"https://api.github.com/users/ebinnion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebinnion/subscriptions","organizations_url":"https://api.github.com/users/ebinnion/orgs","repos_url":"https://api.github.com/users/ebinnion/repos","events_url":"https://api.github.com/users/ebinnion/events{/privacy}","received_events_url":"https://api.github.com/users/ebinnion/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Automattic/jetpack/milestones/35","html_url":"https://github.com/Automattic/jetpack/milestones/4.1","labels_url":"https://api.github.com/repos/Automattic/jetpack/milestones/35/labels","id":1461071,"number":35,"title":"4.1","description":"","creator":{"login":"jeherve","id":426388,"avatar_url":"https://avatars.githubusercontent.com/u/426388?v=3","gravatar_id":"","url":"https://api.github.com/users/jeherve","html_url":"https://github.com/jeherve","followers_url":"https://api.github.com/users/jeherve/followers","following_url":"https://api.github.com/users/jeherve/following{/other_user}","gists_url":"https://api.github.com/users/jeherve/gists{/gist_id}","starred_url":"https://api.github.com/users/jeherve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeherve/subscriptions","organizations_url":"https://api.github.com/users/jeherve/orgs","repos_url":"https://api.github.com/users/jeherve/repos","events_url":"https://api.github.com/users/jeherve/events{/privacy}","received_events_url":"https://api.github.com/users/jeherve/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":180,"state":"open","created_at":"2015-12-15T11:07:52Z","updated_at":"2016-06-29T20:35:12Z","due_on":"2016-06-27T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/jetpack/pulls/4252/commits","review_comments_url":"https://api.github.com/repos/Automattic/jetpack/pulls/4252/comments","review_comment_url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/jetpack/issues/4252/comments","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/a733fe2b942927163d34ad79805f9b2226ae10e6","head":{"label":"Automattic:update/sso-show-default-cant-find-user","ref":"update/sso-show-default-cant-find-user","sha":"a733fe2b942927163d34ad79805f9b2226ae10e6","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":15231212,"name":"jetpack","full_name":"Automattic/jetpack","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2016-06-28T12:17:13Z","pushed_at":"2016-06-29T20:35:12Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"http://jetpack.com","size":282283,"stargazers_count":537,"watchers_count":537,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":331,"mirror_url":null,"open_issues_count":709,"forks":331,"open_issues":709,"watchers":537,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"a30d05e030130e10d95e8acdb00d93e8f7223e3d","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":15231212,"name":"jetpack","full_name":"Automattic/jetpack","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2016-06-28T12:17:13Z","pushed_at":"2016-06-29T20:35:12Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"http://jetpack.com","size":282283,"stargazers_count":537,"watchers_count":537,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":331,"mirror_url":null,"open_issues_count":709,"forks":331,"open_issues":709,"watchers":537,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/4252"},"html":{"href":"https://github.com/Automattic/jetpack/pull/4252"},"issue":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/4252"},"comments":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/4252/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/4252/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/4252/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/jetpack/statuses/a733fe2b942927163d34ad79805f9b2226ae10e6"}}}}
{"actor":{"display_login":"enejb"}}