{"action":"closed","number":8445,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/8445","id":50792853,"html_url":"https://github.com/joomla/joomla-cms/pull/8445","diff_url":"https://github.com/joomla/joomla-cms/pull/8445.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/8445.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8445","number":8445,"state":"closed","locked":false,"title":"Make Invalid Token warnings more user friendly","user":{"login":"izharaazmi","id":6706189,"avatar_url":"https://avatars.githubusercontent.com/u/6706189?v=3","gravatar_id":"","url":"https://api.github.com/users/izharaazmi","html_url":"https://github.com/izharaazmi","followers_url":"https://api.github.com/users/izharaazmi/followers","following_url":"https://api.github.com/users/izharaazmi/following{/other_user}","gists_url":"https://api.github.com/users/izharaazmi/gists{/gist_id}","starred_url":"https://api.github.com/users/izharaazmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izharaazmi/subscriptions","organizations_url":"https://api.github.com/users/izharaazmi/orgs","repos_url":"https://api.github.com/users/izharaazmi/repos","events_url":"https://api.github.com/users/izharaazmi/events{/privacy}","received_events_url":"https://api.github.com/users/izharaazmi/received_events","type":"User","site_admin":false},"body":"The session token validation implementation in various controller methods currently gives an empty white screen with \"Invalid token\" text. This is total uninformative to a normal user.\n\nThis update implicitly redirects to the previous page if the token is not valid. To prevent implicit redirect pass `false` as the second argument to  ~~`JSession::validateToken()`~~ `$this->checkToken()` from the `JControllerLegacy` controller instance. \n\nTo make use of this method we need to replace any occurrence of  `JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));` with ~~`JSession::validateToken('post');`~~ `$this->checkToken();`\n## Summary of Changes\n- Based on the discussion below I've removed the method from `JSession` class and put it in the closer context of its application viz. `JControllerLegacy`.\n- All the controllers should now be able to simply call `$this->checkToken()` and the redirection shall be handled implicitly. **Implicit redirection is done to the referrer (calling) page always**.\n- If a custom handling is required such as **alternate redirection url** or **custom response format like JSON** one may call `$this->checkToken` like:\n\n``` php\nif (!$this->checkToken('post', false))\n{\n     // ...\n}\n```\n\nor even directly call the current `JSession::checkToken` (without the **die** part) like:\n\n``` php\nif (!JSession::checkToken('post'))\n{\n     // ...\n}\n```\n\n This will skip the implicit redirection and return false if the token does not match. Then the necessary `if - else` may be implemented as needed.\n## Test Instruction\n\nTo see the effect the respective forms should be submitted after manipulating the token input in the form so as to trigger invalid token situation. This can usually be done by selecting in the browser \"inspect element\" (or similar) and modify the DOM.\n\nIf the token is valid (not manipulated or expired), everything should be working as usual without any difference.\n\nThe necessary changes are made in the front-end which should be tested:\n- In `com_users` component try to register a new user, login, logout, remind username, reset password, save user profile.\n- In `com_contact` submit the contact form to send an email.\n- In `com_content` submit a vote.\n---\n\n**EDIT June 26, 2016:**\nAdded Summary of changes and Test Instructions based on the new changes.\n","created_at":"2015-11-16T10:25:21Z","updated_at":"2016-11-05T10:11:57Z","closed_at":"2016-11-05T10:11:57Z","merged_at":"2016-11-05T10:11:57Z","merge_commit_sha":"a17c0d7c2e7d90348ef52348dc76a5193b870b0a","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/joomla/joomla-cms/milestones/14","html_url":"https://github.com/joomla/joomla-cms/milestones/Joomla%203.7.0","labels_url":"https://api.github.com/repos/joomla/joomla-cms/milestones/14/labels","id":1750036,"number":14,"title":"Joomla 3.7.0","description":"","creator":{"login":"brianteeman","id":1296369,"avatar_url":"https://avatars.githubusercontent.com/u/1296369?v=3","gravatar_id":"","url":"https://api.github.com/users/brianteeman","html_url":"https://github.com/brianteeman","followers_url":"https://api.github.com/users/brianteeman/followers","following_url":"https://api.github.com/users/brianteeman/following{/other_user}","gists_url":"https://api.github.com/users/brianteeman/gists{/gist_id}","starred_url":"https://api.github.com/users/brianteeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianteeman/subscriptions","organizations_url":"https://api.github.com/users/brianteeman/orgs","repos_url":"https://api.github.com/users/brianteeman/repos","events_url":"https://api.github.com/users/brianteeman/events{/privacy}","received_events_url":"https://api.github.com/users/brianteeman/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":283,"state":"open","created_at":"2016-05-05T16:42:34Z","updated_at":"2016-11-05T10:11:57Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/8445/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/8445/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/8445/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/37a95b2f016f4a5623559512c1da676c9757e43d","head":{"label":"izharaazmi:checktoken","ref":"checktoken","sha":"37a95b2f016f4a5623559512c1da676c9757e43d","user":{"login":"izharaazmi","id":6706189,"avatar_url":"https://avatars.githubusercontent.com/u/6706189?v=3","gravatar_id":"","url":"https://api.github.com/users/izharaazmi","html_url":"https://github.com/izharaazmi","followers_url":"https://api.github.com/users/izharaazmi/followers","following_url":"https://api.github.com/users/izharaazmi/following{/other_user}","gists_url":"https://api.github.com/users/izharaazmi/gists{/gist_id}","starred_url":"https://api.github.com/users/izharaazmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izharaazmi/subscriptions","organizations_url":"https://api.github.com/users/izharaazmi/orgs","repos_url":"https://api.github.com/users/izharaazmi/repos","events_url":"https://api.github.com/users/izharaazmi/events{/privacy}","received_events_url":"https://api.github.com/users/izharaazmi/received_events","type":"User","site_admin":false},"repo":{"id":17852054,"name":"joomla-cms","full_name":"izharaazmi/joomla-cms","owner":{"login":"izharaazmi","id":6706189,"avatar_url":"https://avatars.githubusercontent.com/u/6706189?v=3","gravatar_id":"","url":"https://api.github.com/users/izharaazmi","html_url":"https://github.com/izharaazmi","followers_url":"https://api.github.com/users/izharaazmi/followers","following_url":"https://api.github.com/users/izharaazmi/following{/other_user}","gists_url":"https://api.github.com/users/izharaazmi/gists{/gist_id}","starred_url":"https://api.github.com/users/izharaazmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izharaazmi/subscriptions","organizations_url":"https://api.github.com/users/izharaazmi/orgs","repos_url":"https://api.github.com/users/izharaazmi/repos","events_url":"https://api.github.com/users/izharaazmi/events{/privacy}","received_events_url":"https://api.github.com/users/izharaazmi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/izharaazmi/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/izharaazmi/joomla-cms","forks_url":"https://api.github.com/repos/izharaazmi/joomla-cms/forks","keys_url":"https://api.github.com/repos/izharaazmi/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/izharaazmi/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/izharaazmi/joomla-cms/teams","hooks_url":"https://api.github.com/repos/izharaazmi/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/izharaazmi/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/izharaazmi/joomla-cms/events","assignees_url":"https://api.github.com/repos/izharaazmi/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/izharaazmi/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/izharaazmi/joomla-cms/tags","blobs_url":"https://api.github.com/repos/izharaazmi/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/izharaazmi/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/izharaazmi/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/izharaazmi/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/izharaazmi/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/izharaazmi/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/izharaazmi/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/izharaazmi/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/izharaazmi/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/izharaazmi/joomla-cms/subscription","commits_url":"https://api.github.com/repos/izharaazmi/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/izharaazmi/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/izharaazmi/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/izharaazmi/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/izharaazmi/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/izharaazmi/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/izharaazmi/joomla-cms/merges","archive_url":"https://api.github.com/repos/izharaazmi/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/izharaazmi/joomla-cms/downloads","issues_url":"https://api.github.com/repos/izharaazmi/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/izharaazmi/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/izharaazmi/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/izharaazmi/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/izharaazmi/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/izharaazmi/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/izharaazmi/joomla-cms/deployments","created_at":"2014-03-18T03:09:04Z","updated_at":"2016-10-18T15:02:22Z","pushed_at":"2016-11-05T09:48:39Z","git_url":"git://github.com/izharaazmi/joomla-cms.git","ssh_url":"git@github.com:izharaazmi/joomla-cms.git","clone_url":"https://github.com/izharaazmi/joomla-cms.git","svn_url":"https://github.com/izharaazmi/joomla-cms","homepage":"http://joomla.org","size":163298,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"49684115e94144613fb742043b29f714e3af0d84","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","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://avatars.githubusercontent.com/u/751633?v=3","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":"2016-11-05T05:41:59Z","pushed_at":"2016-11-05T10:11:57Z","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":308665,"stargazers_count":2178,"watchers_count":2178,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2328,"mirror_url":null,"open_issues_count":540,"forks":2328,"open_issues":540,"watchers":2178,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/8445"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/8445"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/8445"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/8445/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/8445/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/8445/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/37a95b2f016f4a5623559512c1da676c9757e43d"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"rdeutz","id":467356,"avatar_url":"https://avatars.githubusercontent.com/u/467356?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeutz","html_url":"https://github.com/rdeutz","followers_url":"https://api.github.com/users/rdeutz/followers","following_url":"https://api.github.com/users/rdeutz/following{/other_user}","gists_url":"https://api.github.com/users/rdeutz/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeutz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeutz/subscriptions","organizations_url":"https://api.github.com/users/rdeutz/orgs","repos_url":"https://api.github.com/users/rdeutz/repos","events_url":"https://api.github.com/users/rdeutz/events{/privacy}","received_events_url":"https://api.github.com/users/rdeutz/received_events","type":"User","site_admin":false},"comments":23,"review_comments":4,"commits":5,"additions":49,"deletions":13,"changed_files":11}}
{"actor":{"display_login":"rdeutz"}}