{"action":"created","comment":{"url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/comments/27772075","id":27772075,"diff_hunk":"@@ -3,14 +3,24 @@ def new\n   end\n \n   def create\n-    user = User.find_by_email(params[:session][:email])\n-    if user && user.authenticate(params[:session][:password])\n-      session[:user_id] = user.id\n-      flash[:success] = \"Welcome, #{user.full_name}.\"\n+    if params[:session]\n+      user = User.find_by_email(params[:session][:email])\n+      if user && user.authenticate(params[:session][:password])\n+        session[:user_id] = user.id\n+        flash[:success] = \"Welcome, #{user.full_name}.\"\n+      else\n+        flash[:danger] = \"Invalid login.\"\n+      end\n     else\n-      flash[:danger] = 'Invalid login.'\n+      user = User.find_or_create_from_auth(request.env[\"omniauth.auth\"])\n+      if user\n+        session[:user_id] = user.id\n+        flash[:success] = \"Welcome, #{user.full_name}.\"\n+      else\n+        flash[:danger] = \"Invalid login.\"\n+      end\n     end\n-    redirect_to(:back)\n+    redirect_to items_path","path":"app/controllers/sessions_controller.rb","position":27,"original_position":27,"commit_id":"8295dfe09baabe24b8b64038f4cf6625c2558941","original_commit_id":"8295dfe09baabe24b8b64038f4cf6625c2558941","user":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"body":"@indiesquidge  because when users login with twitter it takes them to a twitter page, so it doesn't have to be items, but we can't send them back to the twitter page as it's a different site. ","created_at":"2015-04-04T20:56:26Z","updated_at":"2015-04-04T20:56:26Z","html_url":"https://github.com/paulgrever/the_pivot/pull/28#discussion_r27772075","pull_request_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/comments/27772075"},"html":{"href":"https://github.com/paulgrever/the_pivot/pull/28#discussion_r27772075"},"pull_request":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28","id":32566026,"html_url":"https://github.com/paulgrever/the_pivot/pull/28","diff_url":"https://github.com/paulgrever/the_pivot/pull/28.diff","patch_url":"https://github.com/paulgrever/the_pivot/pull/28.patch","issue_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/28","number":28,"state":"open","locked":false,"title":"Twitter authentication","user":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"body":"closes #29 \r\ncloses #30 ","created_at":"2015-04-03T02:19:08Z","updated_at":"2015-04-04T20:56:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc6e2bbfa4063f767d57e9102524906c0c979717","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28/commits","review_comments_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28/comments","review_comment_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/28/comments","statuses_url":"https://api.github.com/repos/paulgrever/the_pivot/statuses/8295dfe09baabe24b8b64038f4cf6625c2558941","head":{"label":"paulgrever:twitter-authentication","ref":"twitter-authentication","sha":"8295dfe09baabe24b8b64038f4cf6625c2558941","user":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"repo":{"id":33142195,"name":"the_pivot","full_name":"paulgrever/the_pivot","owner":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paulgrever/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/paulgrever/the_pivot","forks_url":"https://api.github.com/repos/paulgrever/the_pivot/forks","keys_url":"https://api.github.com/repos/paulgrever/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paulgrever/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paulgrever/the_pivot/teams","hooks_url":"https://api.github.com/repos/paulgrever/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/paulgrever/the_pivot/events","assignees_url":"https://api.github.com/repos/paulgrever/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/paulgrever/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/paulgrever/the_pivot/tags","blobs_url":"https://api.github.com/repos/paulgrever/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paulgrever/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paulgrever/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/paulgrever/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paulgrever/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/paulgrever/the_pivot/languages","stargazers_url":"https://api.github.com/repos/paulgrever/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/paulgrever/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/paulgrever/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/paulgrever/the_pivot/subscription","commits_url":"https://api.github.com/repos/paulgrever/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/paulgrever/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/paulgrever/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/paulgrever/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/paulgrever/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paulgrever/the_pivot/merges","archive_url":"https://api.github.com/repos/paulgrever/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paulgrever/the_pivot/downloads","issues_url":"https://api.github.com/repos/paulgrever/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/paulgrever/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/paulgrever/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paulgrever/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/paulgrever/the_pivot/releases{/id}","created_at":"2015-03-30T19:05:51Z","updated_at":"2015-04-02T21:20:59Z","pushed_at":"2015-04-04T18:35:09Z","git_url":"git://github.com/paulgrever/the_pivot.git","ssh_url":"git@github.com:paulgrever/the_pivot.git","clone_url":"https://github.com/paulgrever/the_pivot.git","svn_url":"https://github.com/paulgrever/the_pivot","homepage":null,"size":9227,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":1,"default_branch":"master"}},"base":{"label":"paulgrever:master","ref":"master","sha":"5bf0976df39be9d846a218848b84337c1c4d5fde","user":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"repo":{"id":33142195,"name":"the_pivot","full_name":"paulgrever/the_pivot","owner":{"login":"paulgrever","id":3664281,"avatar_url":"https://avatars.githubusercontent.com/u/3664281?v=3","gravatar_id":"","url":"https://api.github.com/users/paulgrever","html_url":"https://github.com/paulgrever","followers_url":"https://api.github.com/users/paulgrever/followers","following_url":"https://api.github.com/users/paulgrever/following{/other_user}","gists_url":"https://api.github.com/users/paulgrever/gists{/gist_id}","starred_url":"https://api.github.com/users/paulgrever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulgrever/subscriptions","organizations_url":"https://api.github.com/users/paulgrever/orgs","repos_url":"https://api.github.com/users/paulgrever/repos","events_url":"https://api.github.com/users/paulgrever/events{/privacy}","received_events_url":"https://api.github.com/users/paulgrever/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paulgrever/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/paulgrever/the_pivot","forks_url":"https://api.github.com/repos/paulgrever/the_pivot/forks","keys_url":"https://api.github.com/repos/paulgrever/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paulgrever/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paulgrever/the_pivot/teams","hooks_url":"https://api.github.com/repos/paulgrever/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/paulgrever/the_pivot/events","assignees_url":"https://api.github.com/repos/paulgrever/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/paulgrever/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/paulgrever/the_pivot/tags","blobs_url":"https://api.github.com/repos/paulgrever/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paulgrever/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paulgrever/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/paulgrever/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paulgrever/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/paulgrever/the_pivot/languages","stargazers_url":"https://api.github.com/repos/paulgrever/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/paulgrever/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/paulgrever/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/paulgrever/the_pivot/subscription","commits_url":"https://api.github.com/repos/paulgrever/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/paulgrever/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/paulgrever/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/paulgrever/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/paulgrever/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/paulgrever/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paulgrever/the_pivot/merges","archive_url":"https://api.github.com/repos/paulgrever/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paulgrever/the_pivot/downloads","issues_url":"https://api.github.com/repos/paulgrever/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/paulgrever/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/paulgrever/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/paulgrever/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paulgrever/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/paulgrever/the_pivot/releases{/id}","created_at":"2015-03-30T19:05:51Z","updated_at":"2015-04-02T21:20:59Z","pushed_at":"2015-04-04T18:35:09Z","git_url":"git://github.com/paulgrever/the_pivot.git","ssh_url":"git@github.com:paulgrever/the_pivot.git","clone_url":"https://github.com/paulgrever/the_pivot.git","svn_url":"https://github.com/paulgrever/the_pivot","homepage":null,"size":9227,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28"},"html":{"href":"https://github.com/paulgrever/the_pivot/pull/28"},"issue":{"href":"https://api.github.com/repos/paulgrever/the_pivot/issues/28"},"comments":{"href":"https://api.github.com/repos/paulgrever/the_pivot/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paulgrever/the_pivot/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/paulgrever/the_pivot/statuses/8295dfe09baabe24b8b64038f4cf6625c2558941"}}}}