{"action":"created","comment":{"url":"https://api.github.com/repos/limpkin/mooltipass/pulls/comments/126765205","pull_request_review_id":49281054,"id":126765205,"diff_hunk":"@@ -931,61 +931,40 @@ mcCombinations.prototype.doSubmit = function doSubmit( currentForm ) {\n \t\n \t// Do not autosubmit forms with Captcha\n \tif ( cip.formHasCaptcha ) return;\n-\n-\tif ( currentForm.element ) {\n-\t\t// Sites like Steam use a button outside the form:\n-\t\t/*if ( mpJQ('button:submit').length == 1 ) {\n-\t\t\t// Make sure it is the button we're looking for:\n-\t\t\tif ( mpJQ('button:submit').find('span').length == 1 ) {\n-\t\t\t\tmpJQ('button:submit').find('span').click();\n-\t\t\t\treturn;\t\n+\t\n+\t// Trying to find submit button and trigger click event.\n+\t\n+\tvar ACCEPT_PATTERNS = [/submit/i, /login/i, /identifierNext/i, /passwordNext/i, /verify_user_btn/i],\n+\t\t\tIGNORE_PATTERNS = [/id=\".*?search.*?\"/i],\n+\t\t\tBUTTON_SELECTOR = 'button:visible, [type=\"submit\"]:visible, a:visible, [role=\"button\"]:visible'\n+\t\t\t\n+\t// Check that form element is in DOM. There are cases when form has been reattached.\n+\tvar $root = mpJQ(mpJQ.contains(document, currentForm.element[0]) ? currentForm.element : mpJQ('body')),\n+\t\t\tsubmitButton = null\n+\t\n+\t// Traversing DOM from form element to top in case there is a button outside the form.\n+\twhile (!submitButton && $root[0] != mpJQ('html')[0]) {\n+\t\tsubmitButton = $root.find(BUTTON_SELECTOR).filter(function(index, button) {\n+\t\t\tfor (var i = 0; i < IGNORE_PATTERNS.length; i++) {\n+\t\t\t\tif (button.outerHTML.match(IGNORE_PATTERNS[i])) return false\n \t\t\t}\n-\t\t}*/\n-\n-\t\t// Try to click the submit element\n-\t\tvar submitButton = currentForm.element.find(':submit:visible');\n-\t\t// Check if we found a button\n-\t\tif ( submitButton.length > 0 )\n-\t\t{\n-\t\t\tvar selectedButton = submitButton[0];\n-\t\t\t// If there are multiple buttons\n-\t\t\tif (submitButton.length > 1)\n-\t\t\t{\n-\t\t\t\t// Simply discard buttons that may have \"search\" in their ids\n-\t\t\t\tfor (i = 0; i < submitButton.length; i++)\n-\t\t\t\t{\n-\t\t\t\t\tif (submitButton[i].id && !submitButton[i].id.includes(\"search\") && !submitButton[i].id.includes(\"Search\"))\n-\t\t\t\t\t{\n-\t\t\t\t\t\tselectedButton = submitButton[i];\n-\t\t\t\t\t\tbreak;\n-\t\t\t\t\t}\n-\t\t\t\t}\n+\t\t\t\n+\t\t\tfor (var i = 0; i < ACCEPT_PATTERNS.length; i++) {\n+\t\t\t\tif (button.outerHTML.match(ACCEPT_PATTERNS[i])) return true\n \t\t\t}\n-\t\t}\n-\t\tif ( submitButton.length > 0 ) { \n-\t\t\t// Add timeout to allow form check procedures to run\n-\t\t\tsetTimeout( function() {\n-\t\t\t\tselectedButton.click();\n-\t\t\t},100);\n-\t\t} else if ( mpJQ('#verify_user_btn').length > 0 ) { // Exclusive else/if for Autodesk.com (probably it could be used in more 2 steps login procedures)\n-\t\t\tmpJQ('#verify_user_btn').click();\n-\t\t} else if (window.location.hostname == 'accounts.google.com') { // Special case for google\n-            if (mpJQ('#identifierNext').length > 0)\n-            {\n-                mpJQ('#identifierNext').click();\n-            }\n-            if (mpJQ('#passwordNext').length > 0)\n-            {\n-                mpJQ('#passwordNext').click();\n-            }            \n-        } else if ( currentForm.element ) {\n-\t\t\t// If no submit button is found, just submit the form\n-\t\t\tcurrentForm.element.submit();\n-\t\t}\n-\t} else { // There is no FORM element. Click stuff around\n-\t\tsetTimeout( function() {\n-\t\t\tmpJQ('#sign-in, .btn-submit, #verify_user_btn').click();\n-\t\t},1500);\n+\t\t})[0]\n+\t\t\n+\t\t$root = $($root.parent()[0] || mpJQ('body'))\n+\t}\n+\t\n+\tif (submitButton) {\n+\t\t// Select innermost element to trigger click. Event will be propagated anyway.\n+\t\tsubmitButton = mpJQ(submitButton).find(':not(:has(*))')[0] || submitButton\n+\t\t\n+\t\tmpJQ(submitButton).trigger('click')","path":"chrome_extension/vendor/mooltipass/mcCombinations.js","position":87,"original_position":87,"commit_id":"b0a7957131e95c3516961cc3b91cb1f23016f443","original_commit_id":"b0a7957131e95c3516961cc3b91cb1f23016f443","user":{"login":"limpkin","id":6170291,"avatar_url":"https://avatars1.githubusercontent.com/u/6170291?v=3","gravatar_id":"","url":"https://api.github.com/users/limpkin","html_url":"https://github.com/limpkin","followers_url":"https://api.github.com/users/limpkin/followers","following_url":"https://api.github.com/users/limpkin/following{/other_user}","gists_url":"https://api.github.com/users/limpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/limpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limpkin/subscriptions","organizations_url":"https://api.github.com/users/limpkin/orgs","repos_url":"https://api.github.com/users/limpkin/repos","events_url":"https://api.github.com/users/limpkin/events{/privacy}","received_events_url":"https://api.github.com/users/limpkin/received_events","type":"User","site_admin":false},"body":"so before we were submitting and then clicking the button, and now we're doing the opposite? coud you explain why?","created_at":"2017-07-11T18:04:49Z","updated_at":"2017-07-11T18:04:49Z","html_url":"https://github.com/limpkin/mooltipass/pull/447#discussion_r126765205","pull_request_url":"https://api.github.com/repos/limpkin/mooltipass/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/comments/126765205"},"html":{"href":"https://github.com/limpkin/mooltipass/pull/447#discussion_r126765205"},"pull_request":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/limpkin/mooltipass/pulls/447","id":129962431,"html_url":"https://github.com/limpkin/mooltipass/pull/447","diff_url":"https://github.com/limpkin/mooltipass/pull/447.diff","patch_url":"https://github.com/limpkin/mooltipass/pull/447.patch","issue_url":"https://api.github.com/repos/limpkin/mooltipass/issues/447","number":447,"state":"open","locked":false,"title":"revisited submit and missing form data","user":{"login":"reepush","id":8476339,"avatar_url":"https://avatars3.githubusercontent.com/u/8476339?v=3","gravatar_id":"","url":"https://api.github.com/users/reepush","html_url":"https://github.com/reepush","followers_url":"https://api.github.com/users/reepush/followers","following_url":"https://api.github.com/users/reepush/following{/other_user}","gists_url":"https://api.github.com/users/reepush/gists{/gist_id}","starred_url":"https://api.github.com/users/reepush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reepush/subscriptions","organizations_url":"https://api.github.com/users/reepush/orgs","repos_url":"https://api.github.com/users/reepush/repos","events_url":"https://api.github.com/users/reepush/events{/privacy}","received_events_url":"https://api.github.com/users/reepush/received_events","type":"User","site_admin":false},"body":"New _doSubmit_ implementation. Now we focus on buttons for submitting forms with more flexible detection by adding `ACCEPT_PATTERNS` and `IGNORE_PATTERNS`. Also there is a fix for missing post requests from previous pull request.\r\n\r\nTested on the recently reported sites:\r\n* https://web.tresorit.com/login\r\n* https://www.vodafone.de/ussa/login/login.ftel\r\n* https://nordinary-com.netcup-mail.de/SOGo/\r\n* https://accounts.google.com/ServiceLogin\r\n\r\nAlso setting tests now.","created_at":"2017-07-11T17:23:38Z","updated_at":"2017-07-11T18:04:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56de84d057ace7b786e1c53326c29deb6221608e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/limpkin/mooltipass/pulls/447/commits","review_comments_url":"https://api.github.com/repos/limpkin/mooltipass/pulls/447/comments","review_comment_url":"https://api.github.com/repos/limpkin/mooltipass/pulls/comments{/number}","comments_url":"https://api.github.com/repos/limpkin/mooltipass/issues/447/comments","statuses_url":"https://api.github.com/repos/limpkin/mooltipass/statuses/b0a7957131e95c3516961cc3b91cb1f23016f443","head":{"label":"reepush:submit-revisited","ref":"submit-revisited","sha":"b0a7957131e95c3516961cc3b91cb1f23016f443","user":{"login":"reepush","id":8476339,"avatar_url":"https://avatars3.githubusercontent.com/u/8476339?v=3","gravatar_id":"","url":"https://api.github.com/users/reepush","html_url":"https://github.com/reepush","followers_url":"https://api.github.com/users/reepush/followers","following_url":"https://api.github.com/users/reepush/following{/other_user}","gists_url":"https://api.github.com/users/reepush/gists{/gist_id}","starred_url":"https://api.github.com/users/reepush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reepush/subscriptions","organizations_url":"https://api.github.com/users/reepush/orgs","repos_url":"https://api.github.com/users/reepush/repos","events_url":"https://api.github.com/users/reepush/events{/privacy}","received_events_url":"https://api.github.com/users/reepush/received_events","type":"User","site_admin":false},"repo":{"id":95576277,"name":"mooltipass","full_name":"reepush/mooltipass","owner":{"login":"reepush","id":8476339,"avatar_url":"https://avatars3.githubusercontent.com/u/8476339?v=3","gravatar_id":"","url":"https://api.github.com/users/reepush","html_url":"https://github.com/reepush","followers_url":"https://api.github.com/users/reepush/followers","following_url":"https://api.github.com/users/reepush/following{/other_user}","gists_url":"https://api.github.com/users/reepush/gists{/gist_id}","starred_url":"https://api.github.com/users/reepush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reepush/subscriptions","organizations_url":"https://api.github.com/users/reepush/orgs","repos_url":"https://api.github.com/users/reepush/repos","events_url":"https://api.github.com/users/reepush/events{/privacy}","received_events_url":"https://api.github.com/users/reepush/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reepush/mooltipass","description":"Github repository dedicated to the mooltipass project","fork":true,"url":"https://api.github.com/repos/reepush/mooltipass","forks_url":"https://api.github.com/repos/reepush/mooltipass/forks","keys_url":"https://api.github.com/repos/reepush/mooltipass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reepush/mooltipass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reepush/mooltipass/teams","hooks_url":"https://api.github.com/repos/reepush/mooltipass/hooks","issue_events_url":"https://api.github.com/repos/reepush/mooltipass/issues/events{/number}","events_url":"https://api.github.com/repos/reepush/mooltipass/events","assignees_url":"https://api.github.com/repos/reepush/mooltipass/assignees{/user}","branches_url":"https://api.github.com/repos/reepush/mooltipass/branches{/branch}","tags_url":"https://api.github.com/repos/reepush/mooltipass/tags","blobs_url":"https://api.github.com/repos/reepush/mooltipass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reepush/mooltipass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reepush/mooltipass/git/refs{/sha}","trees_url":"https://api.github.com/repos/reepush/mooltipass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reepush/mooltipass/statuses/{sha}","languages_url":"https://api.github.com/repos/reepush/mooltipass/languages","stargazers_url":"https://api.github.com/repos/reepush/mooltipass/stargazers","contributors_url":"https://api.github.com/repos/reepush/mooltipass/contributors","subscribers_url":"https://api.github.com/repos/reepush/mooltipass/subscribers","subscription_url":"https://api.github.com/repos/reepush/mooltipass/subscription","commits_url":"https://api.github.com/repos/reepush/mooltipass/commits{/sha}","git_commits_url":"https://api.github.com/repos/reepush/mooltipass/git/commits{/sha}","comments_url":"https://api.github.com/repos/reepush/mooltipass/comments{/number}","issue_comment_url":"https://api.github.com/repos/reepush/mooltipass/issues/comments{/number}","contents_url":"https://api.github.com/repos/reepush/mooltipass/contents/{+path}","compare_url":"https://api.github.com/repos/reepush/mooltipass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reepush/mooltipass/merges","archive_url":"https://api.github.com/repos/reepush/mooltipass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reepush/mooltipass/downloads","issues_url":"https://api.github.com/repos/reepush/mooltipass/issues{/number}","pulls_url":"https://api.github.com/repos/reepush/mooltipass/pulls{/number}","milestones_url":"https://api.github.com/repos/reepush/mooltipass/milestones{/number}","notifications_url":"https://api.github.com/repos/reepush/mooltipass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reepush/mooltipass/labels{/name}","releases_url":"https://api.github.com/repos/reepush/mooltipass/releases{/id}","deployments_url":"https://api.github.com/repos/reepush/mooltipass/deployments","created_at":"2017-06-27T15:59:49Z","updated_at":"2017-06-27T16:00:02Z","pushed_at":"2017-07-11T17:49:37Z","git_url":"git://github.com/reepush/mooltipass.git","ssh_url":"git@github.com:reepush/mooltipass.git","clone_url":"https://github.com/reepush/mooltipass.git","svn_url":"https://github.com/reepush/mooltipass","homepage":"http://www.themooltipass.com","size":398928,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"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":"limpkin:master","ref":"master","sha":"d8cf03baff73bc473b966611e11d3aa07ff5cc8a","user":{"login":"limpkin","id":6170291,"avatar_url":"https://avatars1.githubusercontent.com/u/6170291?v=3","gravatar_id":"","url":"https://api.github.com/users/limpkin","html_url":"https://github.com/limpkin","followers_url":"https://api.github.com/users/limpkin/followers","following_url":"https://api.github.com/users/limpkin/following{/other_user}","gists_url":"https://api.github.com/users/limpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/limpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limpkin/subscriptions","organizations_url":"https://api.github.com/users/limpkin/orgs","repos_url":"https://api.github.com/users/limpkin/repos","events_url":"https://api.github.com/users/limpkin/events{/privacy}","received_events_url":"https://api.github.com/users/limpkin/received_events","type":"User","site_admin":false},"repo":{"id":15137572,"name":"mooltipass","full_name":"limpkin/mooltipass","owner":{"login":"limpkin","id":6170291,"avatar_url":"https://avatars1.githubusercontent.com/u/6170291?v=3","gravatar_id":"","url":"https://api.github.com/users/limpkin","html_url":"https://github.com/limpkin","followers_url":"https://api.github.com/users/limpkin/followers","following_url":"https://api.github.com/users/limpkin/following{/other_user}","gists_url":"https://api.github.com/users/limpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/limpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limpkin/subscriptions","organizations_url":"https://api.github.com/users/limpkin/orgs","repos_url":"https://api.github.com/users/limpkin/repos","events_url":"https://api.github.com/users/limpkin/events{/privacy}","received_events_url":"https://api.github.com/users/limpkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/limpkin/mooltipass","description":"Github repository dedicated to the mooltipass project","fork":false,"url":"https://api.github.com/repos/limpkin/mooltipass","forks_url":"https://api.github.com/repos/limpkin/mooltipass/forks","keys_url":"https://api.github.com/repos/limpkin/mooltipass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/limpkin/mooltipass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/limpkin/mooltipass/teams","hooks_url":"https://api.github.com/repos/limpkin/mooltipass/hooks","issue_events_url":"https://api.github.com/repos/limpkin/mooltipass/issues/events{/number}","events_url":"https://api.github.com/repos/limpkin/mooltipass/events","assignees_url":"https://api.github.com/repos/limpkin/mooltipass/assignees{/user}","branches_url":"https://api.github.com/repos/limpkin/mooltipass/branches{/branch}","tags_url":"https://api.github.com/repos/limpkin/mooltipass/tags","blobs_url":"https://api.github.com/repos/limpkin/mooltipass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/limpkin/mooltipass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/limpkin/mooltipass/git/refs{/sha}","trees_url":"https://api.github.com/repos/limpkin/mooltipass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/limpkin/mooltipass/statuses/{sha}","languages_url":"https://api.github.com/repos/limpkin/mooltipass/languages","stargazers_url":"https://api.github.com/repos/limpkin/mooltipass/stargazers","contributors_url":"https://api.github.com/repos/limpkin/mooltipass/contributors","subscribers_url":"https://api.github.com/repos/limpkin/mooltipass/subscribers","subscription_url":"https://api.github.com/repos/limpkin/mooltipass/subscription","commits_url":"https://api.github.com/repos/limpkin/mooltipass/commits{/sha}","git_commits_url":"https://api.github.com/repos/limpkin/mooltipass/git/commits{/sha}","comments_url":"https://api.github.com/repos/limpkin/mooltipass/comments{/number}","issue_comment_url":"https://api.github.com/repos/limpkin/mooltipass/issues/comments{/number}","contents_url":"https://api.github.com/repos/limpkin/mooltipass/contents/{+path}","compare_url":"https://api.github.com/repos/limpkin/mooltipass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/limpkin/mooltipass/merges","archive_url":"https://api.github.com/repos/limpkin/mooltipass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/limpkin/mooltipass/downloads","issues_url":"https://api.github.com/repos/limpkin/mooltipass/issues{/number}","pulls_url":"https://api.github.com/repos/limpkin/mooltipass/pulls{/number}","milestones_url":"https://api.github.com/repos/limpkin/mooltipass/milestones{/number}","notifications_url":"https://api.github.com/repos/limpkin/mooltipass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/limpkin/mooltipass/labels{/name}","releases_url":"https://api.github.com/repos/limpkin/mooltipass/releases{/id}","deployments_url":"https://api.github.com/repos/limpkin/mooltipass/deployments","created_at":"2013-12-12T14:09:05Z","updated_at":"2017-07-10T12:03:36Z","pushed_at":"2017-07-11T17:23:39Z","git_url":"git://github.com/limpkin/mooltipass.git","ssh_url":"git@github.com:limpkin/mooltipass.git","clone_url":"https://github.com/limpkin/mooltipass.git","svn_url":"https://github.com/limpkin/mooltipass","homepage":"https://www.themooltipass.com","size":398954,"stargazers_count":379,"watchers_count":379,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":34,"forks":93,"open_issues":34,"watchers":379,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/447"},"html":{"href":"https://github.com/limpkin/mooltipass/pull/447"},"issue":{"href":"https://api.github.com/repos/limpkin/mooltipass/issues/447"},"comments":{"href":"https://api.github.com/repos/limpkin/mooltipass/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/limpkin/mooltipass/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/limpkin/mooltipass/statuses/b0a7957131e95c3516961cc3b91cb1f23016f443"}}}}
{"actor":{"display_login":"limpkin"}}