{"action":"created","comment":{"url":"https://api.github.com/repos/miiixr/picklete/pulls/comments/38634648","id":38634648,"diff_hunk":"@@ -19,9 +20,18 @@ AuthController = {\n     });\n   },\n   logout: function(req, res) {\n-    req.logout();\n+    let reference = url.parse(req.headers.referer);\n+    let referencePath = reference.path.split('/');\n+\n     req.session.authenticated = false;\n-    res.redirect('/admin/login');\n+\n+    req.logout();\n+\n+    if (referencePath[1] === 'admin') {\n+      res.redirect('/admin/login');\n+    }\n+    res.redirect('/login');\n+\n   },","path":"api/controllers/AuthController.js","position":null,"original_position":26,"commit_id":"34e408aab111d38a2a937aeca37aa7a483b0ce44","original_commit_id":"33555baa3383b3f441f45bb8e77263fdddb65396","user":{"login":"Negaihoshi","id":1733006,"avatar_url":"https://avatars.githubusercontent.com/u/1733006?v=3","gravatar_id":"","url":"https://api.github.com/users/Negaihoshi","html_url":"https://github.com/Negaihoshi","followers_url":"https://api.github.com/users/Negaihoshi/followers","following_url":"https://api.github.com/users/Negaihoshi/following{/other_user}","gists_url":"https://api.github.com/users/Negaihoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/Negaihoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Negaihoshi/subscriptions","organizations_url":"https://api.github.com/users/Negaihoshi/orgs","repos_url":"https://api.github.com/users/Negaihoshi/repos","events_url":"https://api.github.com/users/Negaihoshi/events{/privacy}","received_events_url":"https://api.github.com/users/Negaihoshi/received_events","type":"User","site_admin":false},"body":"已經修復問題了，當初當作是 coffee 在寫，沒注意到 return 問題","created_at":"2015-09-03T11:15:39Z","updated_at":"2015-09-03T11:15:39Z","html_url":"https://github.com/miiixr/picklete/pull/54#discussion_r38634648","pull_request_url":"https://api.github.com/repos/miiixr/picklete/pulls/54","_links":{"self":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/comments/38634648"},"html":{"href":"https://github.com/miiixr/picklete/pull/54#discussion_r38634648"},"pull_request":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/miiixr/picklete/pulls/54","id":44082833,"html_url":"https://github.com/miiixr/picklete/pull/54","diff_url":"https://github.com/miiixr/picklete/pull/54.diff","patch_url":"https://github.com/miiixr/picklete/pull/54.patch","issue_url":"https://api.github.com/repos/miiixr/picklete/issues/54","number":54,"state":"open","locked":false,"title":"add auth check, logout, redirect","user":{"login":"Negaihoshi","id":1733006,"avatar_url":"https://avatars.githubusercontent.com/u/1733006?v=3","gravatar_id":"","url":"https://api.github.com/users/Negaihoshi","html_url":"https://github.com/Negaihoshi","followers_url":"https://api.github.com/users/Negaihoshi/followers","following_url":"https://api.github.com/users/Negaihoshi/following{/other_user}","gists_url":"https://api.github.com/users/Negaihoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/Negaihoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Negaihoshi/subscriptions","organizations_url":"https://api.github.com/users/Negaihoshi/orgs","repos_url":"https://api.github.com/users/Negaihoshi/repos","events_url":"https://api.github.com/users/Negaihoshi/events{/privacy}","received_events_url":"https://api.github.com/users/Negaihoshi/received_events","type":"User","site_admin":false},"body":"功能完整但是仍然有錯誤\r\n```\r\n[Error: Can't set headers after they are sent.]\r\n```","created_at":"2015-09-03T08:57:02Z","updated_at":"2015-09-03T11:15:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52741d22ad11b597b536a8cbc5046bb3a33d645e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/miiixr/picklete/pulls/54/commits","review_comments_url":"https://api.github.com/repos/miiixr/picklete/pulls/54/comments","review_comment_url":"https://api.github.com/repos/miiixr/picklete/pulls/comments{/number}","comments_url":"https://api.github.com/repos/miiixr/picklete/issues/54/comments","statuses_url":"https://api.github.com/repos/miiixr/picklete/statuses/34e408aab111d38a2a937aeca37aa7a483b0ce44","head":{"label":"Negaihoshi:develop","ref":"develop","sha":"34e408aab111d38a2a937aeca37aa7a483b0ce44","user":{"login":"Negaihoshi","id":1733006,"avatar_url":"https://avatars.githubusercontent.com/u/1733006?v=3","gravatar_id":"","url":"https://api.github.com/users/Negaihoshi","html_url":"https://github.com/Negaihoshi","followers_url":"https://api.github.com/users/Negaihoshi/followers","following_url":"https://api.github.com/users/Negaihoshi/following{/other_user}","gists_url":"https://api.github.com/users/Negaihoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/Negaihoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Negaihoshi/subscriptions","organizations_url":"https://api.github.com/users/Negaihoshi/orgs","repos_url":"https://api.github.com/users/Negaihoshi/repos","events_url":"https://api.github.com/users/Negaihoshi/events{/privacy}","received_events_url":"https://api.github.com/users/Negaihoshi/received_events","type":"User","site_admin":false},"repo":{"id":41165975,"name":"picklete","full_name":"Negaihoshi/picklete","owner":{"login":"Negaihoshi","id":1733006,"avatar_url":"https://avatars.githubusercontent.com/u/1733006?v=3","gravatar_id":"","url":"https://api.github.com/users/Negaihoshi","html_url":"https://github.com/Negaihoshi","followers_url":"https://api.github.com/users/Negaihoshi/followers","following_url":"https://api.github.com/users/Negaihoshi/following{/other_user}","gists_url":"https://api.github.com/users/Negaihoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/Negaihoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Negaihoshi/subscriptions","organizations_url":"https://api.github.com/users/Negaihoshi/orgs","repos_url":"https://api.github.com/users/Negaihoshi/repos","events_url":"https://api.github.com/users/Negaihoshi/events{/privacy}","received_events_url":"https://api.github.com/users/Negaihoshi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Negaihoshi/picklete","description":"","fork":true,"url":"https://api.github.com/repos/Negaihoshi/picklete","forks_url":"https://api.github.com/repos/Negaihoshi/picklete/forks","keys_url":"https://api.github.com/repos/Negaihoshi/picklete/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Negaihoshi/picklete/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Negaihoshi/picklete/teams","hooks_url":"https://api.github.com/repos/Negaihoshi/picklete/hooks","issue_events_url":"https://api.github.com/repos/Negaihoshi/picklete/issues/events{/number}","events_url":"https://api.github.com/repos/Negaihoshi/picklete/events","assignees_url":"https://api.github.com/repos/Negaihoshi/picklete/assignees{/user}","branches_url":"https://api.github.com/repos/Negaihoshi/picklete/branches{/branch}","tags_url":"https://api.github.com/repos/Negaihoshi/picklete/tags","blobs_url":"https://api.github.com/repos/Negaihoshi/picklete/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Negaihoshi/picklete/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Negaihoshi/picklete/git/refs{/sha}","trees_url":"https://api.github.com/repos/Negaihoshi/picklete/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Negaihoshi/picklete/statuses/{sha}","languages_url":"https://api.github.com/repos/Negaihoshi/picklete/languages","stargazers_url":"https://api.github.com/repos/Negaihoshi/picklete/stargazers","contributors_url":"https://api.github.com/repos/Negaihoshi/picklete/contributors","subscribers_url":"https://api.github.com/repos/Negaihoshi/picklete/subscribers","subscription_url":"https://api.github.com/repos/Negaihoshi/picklete/subscription","commits_url":"https://api.github.com/repos/Negaihoshi/picklete/commits{/sha}","git_commits_url":"https://api.github.com/repos/Negaihoshi/picklete/git/commits{/sha}","comments_url":"https://api.github.com/repos/Negaihoshi/picklete/comments{/number}","issue_comment_url":"https://api.github.com/repos/Negaihoshi/picklete/issues/comments{/number}","contents_url":"https://api.github.com/repos/Negaihoshi/picklete/contents/{+path}","compare_url":"https://api.github.com/repos/Negaihoshi/picklete/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Negaihoshi/picklete/merges","archive_url":"https://api.github.com/repos/Negaihoshi/picklete/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Negaihoshi/picklete/downloads","issues_url":"https://api.github.com/repos/Negaihoshi/picklete/issues{/number}","pulls_url":"https://api.github.com/repos/Negaihoshi/picklete/pulls{/number}","milestones_url":"https://api.github.com/repos/Negaihoshi/picklete/milestones{/number}","notifications_url":"https://api.github.com/repos/Negaihoshi/picklete/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Negaihoshi/picklete/labels{/name}","releases_url":"https://api.github.com/repos/Negaihoshi/picklete/releases{/id}","created_at":"2015-08-21T16:27:01Z","updated_at":"2015-09-03T09:03:13Z","pushed_at":"2015-09-03T11:14:34Z","git_url":"git://github.com/Negaihoshi/picklete.git","ssh_url":"git@github.com:Negaihoshi/picklete.git","clone_url":"https://github.com/Negaihoshi/picklete.git","svn_url":"https://github.com/Negaihoshi/picklete","homepage":null,"size":1969,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"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":"develop"}},"base":{"label":"miiixr:develop","ref":"develop","sha":"2e7d763fe622f73b1912184c0f1c8601528e6b85","user":{"login":"miiixr","id":13635773,"avatar_url":"https://avatars.githubusercontent.com/u/13635773?v=3","gravatar_id":"","url":"https://api.github.com/users/miiixr","html_url":"https://github.com/miiixr","followers_url":"https://api.github.com/users/miiixr/followers","following_url":"https://api.github.com/users/miiixr/following{/other_user}","gists_url":"https://api.github.com/users/miiixr/gists{/gist_id}","starred_url":"https://api.github.com/users/miiixr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miiixr/subscriptions","organizations_url":"https://api.github.com/users/miiixr/orgs","repos_url":"https://api.github.com/users/miiixr/repos","events_url":"https://api.github.com/users/miiixr/events{/privacy}","received_events_url":"https://api.github.com/users/miiixr/received_events","type":"Organization","site_admin":false},"repo":{"id":40162704,"name":"picklete","full_name":"miiixr/picklete","owner":{"login":"miiixr","id":13635773,"avatar_url":"https://avatars.githubusercontent.com/u/13635773?v=3","gravatar_id":"","url":"https://api.github.com/users/miiixr","html_url":"https://github.com/miiixr","followers_url":"https://api.github.com/users/miiixr/followers","following_url":"https://api.github.com/users/miiixr/following{/other_user}","gists_url":"https://api.github.com/users/miiixr/gists{/gist_id}","starred_url":"https://api.github.com/users/miiixr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miiixr/subscriptions","organizations_url":"https://api.github.com/users/miiixr/orgs","repos_url":"https://api.github.com/users/miiixr/repos","events_url":"https://api.github.com/users/miiixr/events{/privacy}","received_events_url":"https://api.github.com/users/miiixr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/miiixr/picklete","description":"","fork":false,"url":"https://api.github.com/repos/miiixr/picklete","forks_url":"https://api.github.com/repos/miiixr/picklete/forks","keys_url":"https://api.github.com/repos/miiixr/picklete/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miiixr/picklete/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miiixr/picklete/teams","hooks_url":"https://api.github.com/repos/miiixr/picklete/hooks","issue_events_url":"https://api.github.com/repos/miiixr/picklete/issues/events{/number}","events_url":"https://api.github.com/repos/miiixr/picklete/events","assignees_url":"https://api.github.com/repos/miiixr/picklete/assignees{/user}","branches_url":"https://api.github.com/repos/miiixr/picklete/branches{/branch}","tags_url":"https://api.github.com/repos/miiixr/picklete/tags","blobs_url":"https://api.github.com/repos/miiixr/picklete/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miiixr/picklete/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miiixr/picklete/git/refs{/sha}","trees_url":"https://api.github.com/repos/miiixr/picklete/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miiixr/picklete/statuses/{sha}","languages_url":"https://api.github.com/repos/miiixr/picklete/languages","stargazers_url":"https://api.github.com/repos/miiixr/picklete/stargazers","contributors_url":"https://api.github.com/repos/miiixr/picklete/contributors","subscribers_url":"https://api.github.com/repos/miiixr/picklete/subscribers","subscription_url":"https://api.github.com/repos/miiixr/picklete/subscription","commits_url":"https://api.github.com/repos/miiixr/picklete/commits{/sha}","git_commits_url":"https://api.github.com/repos/miiixr/picklete/git/commits{/sha}","comments_url":"https://api.github.com/repos/miiixr/picklete/comments{/number}","issue_comment_url":"https://api.github.com/repos/miiixr/picklete/issues/comments{/number}","contents_url":"https://api.github.com/repos/miiixr/picklete/contents/{+path}","compare_url":"https://api.github.com/repos/miiixr/picklete/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miiixr/picklete/merges","archive_url":"https://api.github.com/repos/miiixr/picklete/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miiixr/picklete/downloads","issues_url":"https://api.github.com/repos/miiixr/picklete/issues{/number}","pulls_url":"https://api.github.com/repos/miiixr/picklete/pulls{/number}","milestones_url":"https://api.github.com/repos/miiixr/picklete/milestones{/number}","notifications_url":"https://api.github.com/repos/miiixr/picklete/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miiixr/picklete/labels{/name}","releases_url":"https://api.github.com/repos/miiixr/picklete/releases{/id}","created_at":"2015-08-04T04:07:03Z","updated_at":"2015-08-31T00:04:38Z","pushed_at":"2015-09-03T11:14:34Z","git_url":"git://github.com/miiixr/picklete.git","ssh_url":"git@github.com:miiixr/picklete.git","clone_url":"https://github.com/miiixr/picklete.git","svn_url":"https://github.com/miiixr/picklete","homepage":null,"size":2956,"stargazers_count":2,"watchers_count":2,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":5,"forks":9,"open_issues":5,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/54"},"html":{"href":"https://github.com/miiixr/picklete/pull/54"},"issue":{"href":"https://api.github.com/repos/miiixr/picklete/issues/54"},"comments":{"href":"https://api.github.com/repos/miiixr/picklete/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/miiixr/picklete/statuses/34e408aab111d38a2a937aeca37aa7a483b0ce44"}}}}