{"action":"created","comment":{"url":"https://api.github.com/repos/dima716/flashcards/pulls/comments/23615645","id":23615645,"diff_hunk":"@@ -0,0 +1,30 @@\n+class OauthsController < ApplicationController\n+  skip_before_filter :require_login\n+\n+  def oauth\n+    login_at(auth_params[:provider])\n+  end\n+\n+  def callback\n+    provider = auth_params[:provider]\n+    if @user = login_from(provider)\n+      redirect_to root_path, flash: { success: \"Успешный вход с #{provider.titleize}\" }\n+    else\n+      begin\n+        @user = create_from(provider)\n+\n+        reset_session","path":"app/controllers/oauths_controller.rb","position":null,"original_position":16,"commit_id":"7e2b5d1641bf7a6bcd5fd37b38db70cde084aaf8","original_commit_id":"97594c5cc60ea694113e31bb999ef0742ecfc699","user":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"body":"Убивает старую и создает новую сессию. Делается для предотвращения так называемых  [Session Fixation](http://en.wikipedia.org/wiki/Session_fixation) аттак.  \r\nХоть они и маловероятны в данном случае, так как в Rails насколько я понял нельзя задавать переменные сессии через параметры в url по умолчанию, к тому же сессия еще и шифруется. Но безопасность лишней не бывает ) ","created_at":"2015-01-27T15:33:05Z","updated_at":"2015-01-27T15:33:05Z","html_url":"https://github.com/dima716/flashcards/pull/8#discussion_r23615645","pull_request_url":"https://api.github.com/repos/dima716/flashcards/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/comments/23615645"},"html":{"href":"https://github.com/dima716/flashcards/pull/8#discussion_r23615645"},"pull_request":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/dima716/flashcards/pulls/8","id":28066614,"html_url":"https://github.com/dima716/flashcards/pull/8","diff_url":"https://github.com/dima716/flashcards/pull/8.diff","patch_url":"https://github.com/dima716/flashcards/pull/8.patch","issue_url":"https://api.github.com/repos/dima716/flashcards/issues/8","number":8,"state":"open","locked":false,"title":"Eight task","user":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-26T22:33:42Z","updated_at":"2015-01-27T15:33:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1849f0ae9a7f2a289173c7780dd6b50eba28c3bd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dima716/flashcards/pulls/8/commits","review_comments_url":"https://api.github.com/repos/dima716/flashcards/pulls/8/comments","review_comment_url":"https://api.github.com/repos/dima716/flashcards/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dima716/flashcards/issues/8/comments","statuses_url":"https://api.github.com/repos/dima716/flashcards/statuses/7e2b5d1641bf7a6bcd5fd37b38db70cde084aaf8","head":{"label":"dima716:eight_task","ref":"eight_task","sha":"7e2b5d1641bf7a6bcd5fd37b38db70cde084aaf8","user":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"repo":{"id":29141095,"name":"flashcards","full_name":"dima716/flashcards","owner":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dima716/flashcards","description":"Application for managing flash cards","fork":false,"url":"https://api.github.com/repos/dima716/flashcards","forks_url":"https://api.github.com/repos/dima716/flashcards/forks","keys_url":"https://api.github.com/repos/dima716/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dima716/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dima716/flashcards/teams","hooks_url":"https://api.github.com/repos/dima716/flashcards/hooks","issue_events_url":"https://api.github.com/repos/dima716/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/dima716/flashcards/events","assignees_url":"https://api.github.com/repos/dima716/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/dima716/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/dima716/flashcards/tags","blobs_url":"https://api.github.com/repos/dima716/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dima716/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dima716/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/dima716/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dima716/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/dima716/flashcards/languages","stargazers_url":"https://api.github.com/repos/dima716/flashcards/stargazers","contributors_url":"https://api.github.com/repos/dima716/flashcards/contributors","subscribers_url":"https://api.github.com/repos/dima716/flashcards/subscribers","subscription_url":"https://api.github.com/repos/dima716/flashcards/subscription","commits_url":"https://api.github.com/repos/dima716/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/dima716/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/dima716/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/dima716/flashcards/issues/comments/{number}","contents_url":"https://api.github.com/repos/dima716/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/dima716/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dima716/flashcards/merges","archive_url":"https://api.github.com/repos/dima716/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dima716/flashcards/downloads","issues_url":"https://api.github.com/repos/dima716/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/dima716/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/dima716/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/dima716/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dima716/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/dima716/flashcards/releases{/id}","created_at":"2015-01-12T15:12:40Z","updated_at":"2015-01-24T12:09:24Z","pushed_at":"2015-01-27T15:05:47Z","git_url":"git://github.com/dima716/flashcards.git","ssh_url":"git@github.com:dima716/flashcards.git","clone_url":"https://github.com/dima716/flashcards.git","svn_url":"https://github.com/dima716/flashcards","homepage":null,"size":868,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"dima716:master","ref":"master","sha":"68fac693798a8834ceae08cbfad23e30b106f24f","user":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"repo":{"id":29141095,"name":"flashcards","full_name":"dima716/flashcards","owner":{"login":"dima716","id":8137279,"avatar_url":"https://avatars.githubusercontent.com/u/8137279?v=3","gravatar_id":"","url":"https://api.github.com/users/dima716","html_url":"https://github.com/dima716","followers_url":"https://api.github.com/users/dima716/followers","following_url":"https://api.github.com/users/dima716/following{/other_user}","gists_url":"https://api.github.com/users/dima716/gists{/gist_id}","starred_url":"https://api.github.com/users/dima716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dima716/subscriptions","organizations_url":"https://api.github.com/users/dima716/orgs","repos_url":"https://api.github.com/users/dima716/repos","events_url":"https://api.github.com/users/dima716/events{/privacy}","received_events_url":"https://api.github.com/users/dima716/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dima716/flashcards","description":"Application for managing flash cards","fork":false,"url":"https://api.github.com/repos/dima716/flashcards","forks_url":"https://api.github.com/repos/dima716/flashcards/forks","keys_url":"https://api.github.com/repos/dima716/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dima716/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dima716/flashcards/teams","hooks_url":"https://api.github.com/repos/dima716/flashcards/hooks","issue_events_url":"https://api.github.com/repos/dima716/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/dima716/flashcards/events","assignees_url":"https://api.github.com/repos/dima716/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/dima716/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/dima716/flashcards/tags","blobs_url":"https://api.github.com/repos/dima716/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dima716/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dima716/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/dima716/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dima716/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/dima716/flashcards/languages","stargazers_url":"https://api.github.com/repos/dima716/flashcards/stargazers","contributors_url":"https://api.github.com/repos/dima716/flashcards/contributors","subscribers_url":"https://api.github.com/repos/dima716/flashcards/subscribers","subscription_url":"https://api.github.com/repos/dima716/flashcards/subscription","commits_url":"https://api.github.com/repos/dima716/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/dima716/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/dima716/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/dima716/flashcards/issues/comments/{number}","contents_url":"https://api.github.com/repos/dima716/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/dima716/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dima716/flashcards/merges","archive_url":"https://api.github.com/repos/dima716/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dima716/flashcards/downloads","issues_url":"https://api.github.com/repos/dima716/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/dima716/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/dima716/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/dima716/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dima716/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/dima716/flashcards/releases{/id}","created_at":"2015-01-12T15:12:40Z","updated_at":"2015-01-24T12:09:24Z","pushed_at":"2015-01-27T15:05:47Z","git_url":"git://github.com/dima716/flashcards.git","ssh_url":"git@github.com:dima716/flashcards.git","clone_url":"https://github.com/dima716/flashcards.git","svn_url":"https://github.com/dima716/flashcards","homepage":null,"size":868,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/8"},"html":{"href":"https://github.com/dima716/flashcards/pull/8"},"issue":{"href":"https://api.github.com/repos/dima716/flashcards/issues/8"},"comments":{"href":"https://api.github.com/repos/dima716/flashcards/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dima716/flashcards/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/dima716/flashcards/statuses/7e2b5d1641bf7a6bcd5fd37b38db70cde084aaf8"}}}}