{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/182451627","pull_request_review_id":113248921,"id":182451627,"diff_hunk":"@@ -0,0 +1,241 @@\n+<?php\n+/**\n+ * @package     Joomla.Plugin\n+ * @subpackage  Twofactorauth.trust\n+ *\n+ * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.\n+ * @license     GNU General Public License version 2 or later; see LICENSE.txt\n+ */\n+\n+defined('_JEXEC') or die;\n+\n+/**\n+ * Joomla Authentication plugin\n+ *\n+ * @since  __DEPLOY_VERSION__\n+ */\n+class PlgTwofactorauthTrust extends JPlugin\n+{\n+\t/**\n+\t * Application object\n+\t *\n+\t * @var    JApplicationCms\n+\t * @since  __DEPLOY_VERSION__\n+\t */\n+\tprotected $app;\n+\n+\t/**\n+\t * Database object\n+\t *\n+\t * @var    JDatabaseDriver\n+\t * @since  __DEPLOY_VERSION__\n+\t */\n+\tprotected $db;\n+\n+\t/**\n+\t * Set the trust this device cookie only after login is successfully finished.\n+\t *\n+\t * @param   array  $options  Array holding options\n+\t *\n+\t * @return  boolean  True on success\n+\t *\n+\t * @since   __DEPLOY_VERSION__\n+\t */\n+\tpublic function onUserAfterLogin($options)\n+\t{\n+\t\tif (!empty($options['trust']) || $this->app->input->getBool('trust', false))\n+\t\t{\n+\t\t\t// Trust checkbox is set\n+\t\t\t$cookieName = 'joomla_trust_this_device_' . JUserHelper::getShortHashedUserAgent();\n+\n+\t\t\t// Trust checkbox is set\n+\t\t\t$old_series = null;\n+\n+\t\t\t// Get series from cookie\n+\t\t\t$cookieValue = $this->app->input->cookie->get($cookieName);\n+\n+\t\t\tif ($cookieValue)\n+\t\t\t{\n+\t\t\t\t$cookieArray = explode('.', $cookieValue);\n+\n+\t\t\t\t// Check for valid cookie value\n+\t\t\t\tif (count($cookieArray) !== 2)\n+\t\t\t\t{\n+\t\t\t\t\tJLog::add('Invalid cookie detected.', JLog::WARNING, 'error');\n+\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t{\n+\t\t\t\t\t// Filter series since we're going to use it in the query\n+\t\t\t\t\t$filter = new JFilterInput;\n+\t\t\t\t\t$old_series = $filter->clean($cookieArray[1], 'ALNUM');\n+\t\t\t\t}\n+\t\t\t\t// Destroy the cookie in the browser anyway","path":"plugins/twofactorauth/trust/trust.php","position":72,"original_position":72,"commit_id":"f5fe4574a463b26b31b8a74742d9c2e2f3386d9a","original_commit_id":"f5fe4574a463b26b31b8a74742d9c2e2f3386d9a","user":{"login":"Quy","id":368084,"avatar_url":"https://avatars2.githubusercontent.com/u/368084?v=4","gravatar_id":"","url":"https://api.github.com/users/Quy","html_url":"https://github.com/Quy","followers_url":"https://api.github.com/users/Quy/followers","following_url":"https://api.github.com/users/Quy/following{/other_user}","gists_url":"https://api.github.com/users/Quy/gists{/gist_id}","starred_url":"https://api.github.com/users/Quy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Quy/subscriptions","organizations_url":"https://api.github.com/users/Quy/orgs","repos_url":"https://api.github.com/users/Quy/repos","events_url":"https://api.github.com/users/Quy/events{/privacy}","received_events_url":"https://api.github.com/users/Quy/received_events","type":"User","site_admin":false},"body":"Add blank line above.","created_at":"2018-04-18T14:39:39Z","updated_at":"2018-04-18T14:39:39Z","html_url":"https://github.com/joomla/joomla-cms/pull/20191#discussion_r182451627","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/182451627"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/20191#discussion_r182451627"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191","id":182378701,"html_url":"https://github.com/joomla/joomla-cms/pull/20191","diff_url":"https://github.com/joomla/joomla-cms/pull/20191.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/20191.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/20191","number":20191,"state":"open","locked":false,"title":"Two factor authentication - Trust this device","user":{"login":"eshiol","id":12718836,"avatar_url":"https://avatars0.githubusercontent.com/u/12718836?v=4","gravatar_id":"","url":"https://api.github.com/users/eshiol","html_url":"https://github.com/eshiol","followers_url":"https://api.github.com/users/eshiol/followers","following_url":"https://api.github.com/users/eshiol/following{/other_user}","gists_url":"https://api.github.com/users/eshiol/gists{/gist_id}","starred_url":"https://api.github.com/users/eshiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eshiol/subscriptions","organizations_url":"https://api.github.com/users/eshiol/orgs","repos_url":"https://api.github.com/users/eshiol/repos","events_url":"https://api.github.com/users/eshiol/events{/privacy}","received_events_url":"https://api.github.com/users/eshiol/received_events","type":"User","site_admin":false},"body":"Pull Request for Issue #20150.\r\n\r\n### Summary of Changes\r\nThis plugin allows user to mark the computer or mobile device as trusted. With trusted computers and devices, you don’t need to enter a verification code for two factor authentication plug-in each time you sign in.\r\n\r\n### Testing Instructions\r\nEnable the two factor authentication system\r\nAuthenticate yourself with the option trust this device checked\r\nLogout\r\nAuthenticate yourself without using the secret key\r\n\r\n### Expected result\r\nYou can login\r\n\r\n### Actual result\r\n\r\n### Documentation Changes Required\r\n\r\n","created_at":"2018-04-18T06:26:33Z","updated_at":"2018-04-18T14:39:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1ec80e66007b2586c479cc0fc7f01997e0c83a0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":198658453,"url":"https://api.github.com/repos/joomla/joomla-cms/labels/Language%20Change","name":"Language Change","color":"eb6420","default":false},{"id":60721348,"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/20191/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/f5fe4574a463b26b31b8a74742d9c2e2f3386d9a","head":{"label":"eshiol:trust-this-device","ref":"trust-this-device","sha":"f5fe4574a463b26b31b8a74742d9c2e2f3386d9a","user":{"login":"eshiol","id":12718836,"avatar_url":"https://avatars0.githubusercontent.com/u/12718836?v=4","gravatar_id":"","url":"https://api.github.com/users/eshiol","html_url":"https://github.com/eshiol","followers_url":"https://api.github.com/users/eshiol/followers","following_url":"https://api.github.com/users/eshiol/following{/other_user}","gists_url":"https://api.github.com/users/eshiol/gists{/gist_id}","starred_url":"https://api.github.com/users/eshiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eshiol/subscriptions","organizations_url":"https://api.github.com/users/eshiol/orgs","repos_url":"https://api.github.com/users/eshiol/repos","events_url":"https://api.github.com/users/eshiol/events{/privacy}","received_events_url":"https://api.github.com/users/eshiol/received_events","type":"User","site_admin":false},"repo":{"id":104391093,"name":"joomla-cms","full_name":"eshiol/joomla-cms","owner":{"login":"eshiol","id":12718836,"avatar_url":"https://avatars0.githubusercontent.com/u/12718836?v=4","gravatar_id":"","url":"https://api.github.com/users/eshiol","html_url":"https://github.com/eshiol","followers_url":"https://api.github.com/users/eshiol/followers","following_url":"https://api.github.com/users/eshiol/following{/other_user}","gists_url":"https://api.github.com/users/eshiol/gists{/gist_id}","starred_url":"https://api.github.com/users/eshiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eshiol/subscriptions","organizations_url":"https://api.github.com/users/eshiol/orgs","repos_url":"https://api.github.com/users/eshiol/repos","events_url":"https://api.github.com/users/eshiol/events{/privacy}","received_events_url":"https://api.github.com/users/eshiol/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eshiol/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/eshiol/joomla-cms","forks_url":"https://api.github.com/repos/eshiol/joomla-cms/forks","keys_url":"https://api.github.com/repos/eshiol/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eshiol/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eshiol/joomla-cms/teams","hooks_url":"https://api.github.com/repos/eshiol/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/eshiol/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/eshiol/joomla-cms/events","assignees_url":"https://api.github.com/repos/eshiol/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/eshiol/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/eshiol/joomla-cms/tags","blobs_url":"https://api.github.com/repos/eshiol/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eshiol/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eshiol/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/eshiol/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eshiol/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/eshiol/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/eshiol/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/eshiol/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/eshiol/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/eshiol/joomla-cms/subscription","commits_url":"https://api.github.com/repos/eshiol/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/eshiol/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/eshiol/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/eshiol/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/eshiol/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/eshiol/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eshiol/joomla-cms/merges","archive_url":"https://api.github.com/repos/eshiol/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eshiol/joomla-cms/downloads","issues_url":"https://api.github.com/repos/eshiol/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/eshiol/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/eshiol/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/eshiol/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eshiol/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/eshiol/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/eshiol/joomla-cms/deployments","created_at":"2017-09-21T19:40:37Z","updated_at":"2018-03-17T15:55:53Z","pushed_at":"2018-04-18T08:01:13Z","git_url":"git://github.com/eshiol/joomla-cms.git","ssh_url":"git@github.com:eshiol/joomla-cms.git","clone_url":"https://github.com/eshiol/joomla-cms.git","svn_url":"https://github.com/eshiol/joomla-cms","homepage":"https://www.joomla.org","size":211360,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"b5b9d49f98d3b4d95c3b16216504e4ef0c2c5ef1","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars3.githubusercontent.com/u/751633?v=4","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars3.githubusercontent.com/u/751633?v=4","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/joomla/joomla-cms/deployments","created_at":"2011-09-27T02:07:38Z","updated_at":"2018-04-18T14:12:03Z","pushed_at":"2018-04-18T13:49:26Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"https://www.joomla.org","size":228399,"stargazers_count":2710,"watchers_count":2710,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2679,"mirror_url":null,"archived":false,"open_issues_count":822,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":2679,"open_issues":822,"watchers":2710,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/20191"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/20191"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/20191/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/20191/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/f5fe4574a463b26b31b8a74742d9c2e2f3386d9a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Quy"}}