{"action":"created","comment":{"url":"https://api.github.com/repos/thuy96po/sample_app/pulls/comments/196310738","pull_request_review_id":129836185,"id":196310738,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjMxMDczOA==","diff_hunk":"@@ -1,19 +1,25 @@\n class SessionsController < ApplicationController\n+  before_action :set_user, only: :create\n   def new; end\n \n   def create\n-    user = User.find_by(email: params[:session][:email].downcase)\n-    if user && user.authenticate(params[:session][:password])\n-      log_in user\n-      redirect_to user\n+    if @user && @user.authenticate(params[:session][:password])\n+      log_in @user\n+      params[:session][:remember_me] == \"1\" ? remember(@user) : forget(@user)\n+      redirect_to @user\n     else\n       flash[:danger] = t \"sessions.new.flash_danger_content\"\n       render :new\n     end\n   end\n \n   def destroy\n-    log_out\n+    log_out if logged_in?\n     redirect_to root_url\n   end\n+\n+  private\n+  def set_user","path":"app/controllers/sessions_controller.rb","position":27,"original_position":27,"commit_id":"e9a3a22f4e121e5462d8031c66f3f91c7eb62af2","original_commit_id":"e9a3a22f4e121e5462d8031c66f3f91c7eb62af2","user":{"login":"thangtx88","id":18256324,"node_id":"MDQ6VXNlcjE4MjU2MzI0","avatar_url":"https://avatars1.githubusercontent.com/u/18256324?v=4","gravatar_id":"","url":"https://api.github.com/users/thangtx88","html_url":"https://github.com/thangtx88","followers_url":"https://api.github.com/users/thangtx88/followers","following_url":"https://api.github.com/users/thangtx88/following{/other_user}","gists_url":"https://api.github.com/users/thangtx88/gists{/gist_id}","starred_url":"https://api.github.com/users/thangtx88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thangtx88/subscriptions","organizations_url":"https://api.github.com/users/thangtx88/orgs","repos_url":"https://api.github.com/users/thangtx88/repos","events_url":"https://api.github.com/users/thangtx88/events{/privacy}","received_events_url":"https://api.github.com/users/thangtx88/received_events","type":"User","site_admin":false},"body":"bad name","created_at":"2018-06-19T06:50:02Z","updated_at":"2018-06-19T06:50:02Z","html_url":"https://github.com/thuy96po/sample_app/pull/5#discussion_r196310738","pull_request_url":"https://api.github.com/repos/thuy96po/sample_app/pulls/5","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/comments/196310738"},"html":{"href":"https://github.com/thuy96po/sample_app/pull/5#discussion_r196310738"},"pull_request":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/thuy96po/sample_app/pulls/5","id":195725249,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NzI1MjQ5","html_url":"https://github.com/thuy96po/sample_app/pull/5","diff_url":"https://github.com/thuy96po/sample_app/pull/5.diff","patch_url":"https://github.com/thuy96po/sample_app/pull/5.patch","issue_url":"https://api.github.com/repos/thuy96po/sample_app/issues/5","number":5,"state":"open","locked":false,"title":"Chapter 9: Advanced login","user":{"login":"thuy96po","id":40012251,"node_id":"MDQ6VXNlcjQwMDEyMjUx","avatar_url":"https://avatars3.githubusercontent.com/u/40012251?v=4","gravatar_id":"","url":"https://api.github.com/users/thuy96po","html_url":"https://github.com/thuy96po","followers_url":"https://api.github.com/users/thuy96po/followers","following_url":"https://api.github.com/users/thuy96po/following{/other_user}","gists_url":"https://api.github.com/users/thuy96po/gists{/gist_id}","starred_url":"https://api.github.com/users/thuy96po/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuy96po/subscriptions","organizations_url":"https://api.github.com/users/thuy96po/orgs","repos_url":"https://api.github.com/users/thuy96po/repos","events_url":"https://api.github.com/users/thuy96po/events{/privacy}","received_events_url":"https://api.github.com/users/thuy96po/received_events","type":"User","site_admin":false},"body":"![screenshot from 2018-06-19 13-39-06](https://user-images.githubusercontent.com/40012251/41580753-2a745da8-73c6-11e8-9a74-36bd9b1ce859.png)\r\n","created_at":"2018-06-19T06:40:26Z","updated_at":"2018-06-19T06:50:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbf463e89df09d8d19ec0ca433d30e2ca9bfb707","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/thuy96po/sample_app/pulls/5/commits","review_comments_url":"https://api.github.com/repos/thuy96po/sample_app/pulls/5/comments","review_comment_url":"https://api.github.com/repos/thuy96po/sample_app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thuy96po/sample_app/issues/5/comments","statuses_url":"https://api.github.com/repos/thuy96po/sample_app/statuses/e9a3a22f4e121e5462d8031c66f3f91c7eb62af2","head":{"label":"thuy96po:chapter_9","ref":"chapter_9","sha":"e9a3a22f4e121e5462d8031c66f3f91c7eb62af2","user":{"login":"thuy96po","id":40012251,"node_id":"MDQ6VXNlcjQwMDEyMjUx","avatar_url":"https://avatars3.githubusercontent.com/u/40012251?v=4","gravatar_id":"","url":"https://api.github.com/users/thuy96po","html_url":"https://github.com/thuy96po","followers_url":"https://api.github.com/users/thuy96po/followers","following_url":"https://api.github.com/users/thuy96po/following{/other_user}","gists_url":"https://api.github.com/users/thuy96po/gists{/gist_id}","starred_url":"https://api.github.com/users/thuy96po/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuy96po/subscriptions","organizations_url":"https://api.github.com/users/thuy96po/orgs","repos_url":"https://api.github.com/users/thuy96po/repos","events_url":"https://api.github.com/users/thuy96po/events{/privacy}","received_events_url":"https://api.github.com/users/thuy96po/received_events","type":"User","site_admin":false},"repo":{"id":137456585,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0NTY1ODU=","name":"sample_app","full_name":"thuy96po/sample_app","owner":{"login":"thuy96po","id":40012251,"node_id":"MDQ6VXNlcjQwMDEyMjUx","avatar_url":"https://avatars3.githubusercontent.com/u/40012251?v=4","gravatar_id":"","url":"https://api.github.com/users/thuy96po","html_url":"https://github.com/thuy96po","followers_url":"https://api.github.com/users/thuy96po/followers","following_url":"https://api.github.com/users/thuy96po/following{/other_user}","gists_url":"https://api.github.com/users/thuy96po/gists{/gist_id}","starred_url":"https://api.github.com/users/thuy96po/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuy96po/subscriptions","organizations_url":"https://api.github.com/users/thuy96po/orgs","repos_url":"https://api.github.com/users/thuy96po/repos","events_url":"https://api.github.com/users/thuy96po/events{/privacy}","received_events_url":"https://api.github.com/users/thuy96po/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thuy96po/sample_app","description":null,"fork":false,"url":"https://api.github.com/repos/thuy96po/sample_app","forks_url":"https://api.github.com/repos/thuy96po/sample_app/forks","keys_url":"https://api.github.com/repos/thuy96po/sample_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thuy96po/sample_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thuy96po/sample_app/teams","hooks_url":"https://api.github.com/repos/thuy96po/sample_app/hooks","issue_events_url":"https://api.github.com/repos/thuy96po/sample_app/issues/events{/number}","events_url":"https://api.github.com/repos/thuy96po/sample_app/events","assignees_url":"https://api.github.com/repos/thuy96po/sample_app/assignees{/user}","branches_url":"https://api.github.com/repos/thuy96po/sample_app/branches{/branch}","tags_url":"https://api.github.com/repos/thuy96po/sample_app/tags","blobs_url":"https://api.github.com/repos/thuy96po/sample_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thuy96po/sample_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thuy96po/sample_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/thuy96po/sample_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thuy96po/sample_app/statuses/{sha}","languages_url":"https://api.github.com/repos/thuy96po/sample_app/languages","stargazers_url":"https://api.github.com/repos/thuy96po/sample_app/stargazers","contributors_url":"https://api.github.com/repos/thuy96po/sample_app/contributors","subscribers_url":"https://api.github.com/repos/thuy96po/sample_app/subscribers","subscription_url":"https://api.github.com/repos/thuy96po/sample_app/subscription","commits_url":"https://api.github.com/repos/thuy96po/sample_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/thuy96po/sample_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/thuy96po/sample_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/thuy96po/sample_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/thuy96po/sample_app/contents/{+path}","compare_url":"https://api.github.com/repos/thuy96po/sample_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thuy96po/sample_app/merges","archive_url":"https://api.github.com/repos/thuy96po/sample_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thuy96po/sample_app/downloads","issues_url":"https://api.github.com/repos/thuy96po/sample_app/issues{/number}","pulls_url":"https://api.github.com/repos/thuy96po/sample_app/pulls{/number}","milestones_url":"https://api.github.com/repos/thuy96po/sample_app/milestones{/number}","notifications_url":"https://api.github.com/repos/thuy96po/sample_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thuy96po/sample_app/labels{/name}","releases_url":"https://api.github.com/repos/thuy96po/sample_app/releases{/id}","deployments_url":"https://api.github.com/repos/thuy96po/sample_app/deployments","created_at":"2018-06-15T07:39:19Z","updated_at":"2018-06-19T02:49:17Z","pushed_at":"2018-06-19T06:42:12Z","git_url":"git://github.com/thuy96po/sample_app.git","ssh_url":"git@github.com:thuy96po/sample_app.git","clone_url":"https://github.com/thuy96po/sample_app.git","svn_url":"https://github.com/thuy96po/sample_app","homepage":null,"size":205,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"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":"master"}},"base":{"label":"thuy96po:master","ref":"master","sha":"5411538bfe973f079173494c3c745894358a9512","user":{"login":"thuy96po","id":40012251,"node_id":"MDQ6VXNlcjQwMDEyMjUx","avatar_url":"https://avatars3.githubusercontent.com/u/40012251?v=4","gravatar_id":"","url":"https://api.github.com/users/thuy96po","html_url":"https://github.com/thuy96po","followers_url":"https://api.github.com/users/thuy96po/followers","following_url":"https://api.github.com/users/thuy96po/following{/other_user}","gists_url":"https://api.github.com/users/thuy96po/gists{/gist_id}","starred_url":"https://api.github.com/users/thuy96po/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuy96po/subscriptions","organizations_url":"https://api.github.com/users/thuy96po/orgs","repos_url":"https://api.github.com/users/thuy96po/repos","events_url":"https://api.github.com/users/thuy96po/events{/privacy}","received_events_url":"https://api.github.com/users/thuy96po/received_events","type":"User","site_admin":false},"repo":{"id":137456585,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0NTY1ODU=","name":"sample_app","full_name":"thuy96po/sample_app","owner":{"login":"thuy96po","id":40012251,"node_id":"MDQ6VXNlcjQwMDEyMjUx","avatar_url":"https://avatars3.githubusercontent.com/u/40012251?v=4","gravatar_id":"","url":"https://api.github.com/users/thuy96po","html_url":"https://github.com/thuy96po","followers_url":"https://api.github.com/users/thuy96po/followers","following_url":"https://api.github.com/users/thuy96po/following{/other_user}","gists_url":"https://api.github.com/users/thuy96po/gists{/gist_id}","starred_url":"https://api.github.com/users/thuy96po/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuy96po/subscriptions","organizations_url":"https://api.github.com/users/thuy96po/orgs","repos_url":"https://api.github.com/users/thuy96po/repos","events_url":"https://api.github.com/users/thuy96po/events{/privacy}","received_events_url":"https://api.github.com/users/thuy96po/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thuy96po/sample_app","description":null,"fork":false,"url":"https://api.github.com/repos/thuy96po/sample_app","forks_url":"https://api.github.com/repos/thuy96po/sample_app/forks","keys_url":"https://api.github.com/repos/thuy96po/sample_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thuy96po/sample_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thuy96po/sample_app/teams","hooks_url":"https://api.github.com/repos/thuy96po/sample_app/hooks","issue_events_url":"https://api.github.com/repos/thuy96po/sample_app/issues/events{/number}","events_url":"https://api.github.com/repos/thuy96po/sample_app/events","assignees_url":"https://api.github.com/repos/thuy96po/sample_app/assignees{/user}","branches_url":"https://api.github.com/repos/thuy96po/sample_app/branches{/branch}","tags_url":"https://api.github.com/repos/thuy96po/sample_app/tags","blobs_url":"https://api.github.com/repos/thuy96po/sample_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thuy96po/sample_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thuy96po/sample_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/thuy96po/sample_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thuy96po/sample_app/statuses/{sha}","languages_url":"https://api.github.com/repos/thuy96po/sample_app/languages","stargazers_url":"https://api.github.com/repos/thuy96po/sample_app/stargazers","contributors_url":"https://api.github.com/repos/thuy96po/sample_app/contributors","subscribers_url":"https://api.github.com/repos/thuy96po/sample_app/subscribers","subscription_url":"https://api.github.com/repos/thuy96po/sample_app/subscription","commits_url":"https://api.github.com/repos/thuy96po/sample_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/thuy96po/sample_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/thuy96po/sample_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/thuy96po/sample_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/thuy96po/sample_app/contents/{+path}","compare_url":"https://api.github.com/repos/thuy96po/sample_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thuy96po/sample_app/merges","archive_url":"https://api.github.com/repos/thuy96po/sample_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thuy96po/sample_app/downloads","issues_url":"https://api.github.com/repos/thuy96po/sample_app/issues{/number}","pulls_url":"https://api.github.com/repos/thuy96po/sample_app/pulls{/number}","milestones_url":"https://api.github.com/repos/thuy96po/sample_app/milestones{/number}","notifications_url":"https://api.github.com/repos/thuy96po/sample_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thuy96po/sample_app/labels{/name}","releases_url":"https://api.github.com/repos/thuy96po/sample_app/releases{/id}","deployments_url":"https://api.github.com/repos/thuy96po/sample_app/deployments","created_at":"2018-06-15T07:39:19Z","updated_at":"2018-06-19T02:49:17Z","pushed_at":"2018-06-19T06:42:12Z","git_url":"git://github.com/thuy96po/sample_app.git","ssh_url":"git@github.com:thuy96po/sample_app.git","clone_url":"https://github.com/thuy96po/sample_app.git","svn_url":"https://github.com/thuy96po/sample_app","homepage":null,"size":205,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"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":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/5"},"html":{"href":"https://github.com/thuy96po/sample_app/pull/5"},"issue":{"href":"https://api.github.com/repos/thuy96po/sample_app/issues/5"},"comments":{"href":"https://api.github.com/repos/thuy96po/sample_app/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thuy96po/sample_app/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/thuy96po/sample_app/statuses/e9a3a22f4e121e5462d8031c66f3f91c7eb62af2"}},"author_association":"OWNER"}}
{"actor":{"display_login":"thangtx88"}}