{"action":"created","comment":{"url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/comments/123205915","pull_request_review_id":45384702,"id":123205915,"diff_hunk":"@@ -0,0 +1,62 @@\n+class PasswordResetsController < ApplicationController\n+  before_action :load_user, :valid_user, :check_expiration,\n+    only: [:edit, :update]\n+\n+  def new\n+  end\n+\n+  def create\n+    @user = User.find_by email: params[:password_reset][:email].downcase\n+\n+    if @user\n+      @user.create_reset_digest\n+      @user.send_password_reset_email\n+      flash[:info] = t \".email_sent\"\n+      redirect_to root_url\n+    else\n+      flash.now[:danger] = t \".email_not_found\"\n+      render :new\n+    end\n+  end\n+\n+  def update\n+    if params[:user][:password].empty?\n+      @user.errors.add :password, t(\".can_not_be_empty\")\n+      render :edit\n+    elsif @user.update_attributes user_params\n+      flash[:success] = t \".has_reset\"\n+      redirect_to @user\n+    else\n+      render :edit\n+    end\n+  end\n+\n+  def edit\n+  end\n+\n+  private\n+\n+  def user_params\n+    params.require(:user).permit :password, :password_confirmation\n+  end\n+\n+  def load_user\n+    @user = User.find_by email: params[:email]\n+\n+    return if @user\n+    flash[:danger] = t \".not_found\"\n+    redirect_to root_url\n+  end\n+\n+  def valid_user\n+    return if (@user && @user.activated? &&\n+      @user.authenticated?(:reset, params[:id]))\n+        redirect_to root_url\n+  end\n+\n+  def check_expiration\n+    return if not @user.password_reset_expired?\n+      flash[:danger] = t \".has_expired\"","path":"app/controllers/password_resets_controller.rb","position":59,"original_position":59,"commit_id":"ac324dbbbb00dbe489c1b353847cdab785b58a0c","original_commit_id":"ac324dbbbb00dbe489c1b353847cdab785b58a0c","user":{"login":"hungnh103","id":22311747,"avatar_url":"https://avatars3.githubusercontent.com/u/22311747?v=3","gravatar_id":"","url":"https://api.github.com/users/hungnh103","html_url":"https://github.com/hungnh103","followers_url":"https://api.github.com/users/hungnh103/followers","following_url":"https://api.github.com/users/hungnh103/following{/other_user}","gists_url":"https://api.github.com/users/hungnh103/gists{/gist_id}","starred_url":"https://api.github.com/users/hungnh103/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hungnh103/subscriptions","organizations_url":"https://api.github.com/users/hungnh103/orgs","repos_url":"https://api.github.com/users/hungnh103/repos","events_url":"https://api.github.com/users/hungnh103/events{/privacy}","received_events_url":"https://api.github.com/users/hungnh103/received_events","type":"User","site_admin":false},"body":"indent","created_at":"2017-06-21T10:06:04Z","updated_at":"2017-06-21T10:07:50Z","html_url":"https://github.com/suuhv/Framgia-railstutorial/pull/9#discussion_r123205915","pull_request_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/comments/123205915"},"html":{"href":"https://github.com/suuhv/Framgia-railstutorial/pull/9#discussion_r123205915"},"pull_request":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9","id":126434747,"html_url":"https://github.com/suuhv/Framgia-railstutorial/pull/9","diff_url":"https://github.com/suuhv/Framgia-railstutorial/pull/9.diff","patch_url":"https://github.com/suuhv/Framgia-railstutorial/pull/9.patch","issue_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/9","number":9,"state":"open","locked":false,"title":"add password reset","user":{"login":"suuhv","id":14865575,"avatar_url":"https://avatars3.githubusercontent.com/u/14865575?v=3","gravatar_id":"","url":"https://api.github.com/users/suuhv","html_url":"https://github.com/suuhv","followers_url":"https://api.github.com/users/suuhv/followers","following_url":"https://api.github.com/users/suuhv/following{/other_user}","gists_url":"https://api.github.com/users/suuhv/gists{/gist_id}","starred_url":"https://api.github.com/users/suuhv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suuhv/subscriptions","organizations_url":"https://api.github.com/users/suuhv/orgs","repos_url":"https://api.github.com/users/suuhv/repos","events_url":"https://api.github.com/users/suuhv/events{/privacy}","received_events_url":"https://api.github.com/users/suuhv/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-20T02:23:24Z","updated_at":"2017-06-21T10:07:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7da732227d2cfd3bfb0fc8e72aeab78997ae87e4","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9/commits","review_comments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9/comments","review_comment_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/comments{/number}","comments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/9/comments","statuses_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/statuses/ac324dbbbb00dbe489c1b353847cdab785b58a0c","head":{"label":"suuhv:chap12","ref":"chap12","sha":"ac324dbbbb00dbe489c1b353847cdab785b58a0c","user":{"login":"suuhv","id":14865575,"avatar_url":"https://avatars3.githubusercontent.com/u/14865575?v=3","gravatar_id":"","url":"https://api.github.com/users/suuhv","html_url":"https://github.com/suuhv","followers_url":"https://api.github.com/users/suuhv/followers","following_url":"https://api.github.com/users/suuhv/following{/other_user}","gists_url":"https://api.github.com/users/suuhv/gists{/gist_id}","starred_url":"https://api.github.com/users/suuhv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suuhv/subscriptions","organizations_url":"https://api.github.com/users/suuhv/orgs","repos_url":"https://api.github.com/users/suuhv/repos","events_url":"https://api.github.com/users/suuhv/events{/privacy}","received_events_url":"https://api.github.com/users/suuhv/received_events","type":"User","site_admin":false},"repo":{"id":93001965,"name":"Framgia-railstutorial","full_name":"suuhv/Framgia-railstutorial","owner":{"login":"suuhv","id":14865575,"avatar_url":"https://avatars3.githubusercontent.com/u/14865575?v=3","gravatar_id":"","url":"https://api.github.com/users/suuhv","html_url":"https://github.com/suuhv","followers_url":"https://api.github.com/users/suuhv/followers","following_url":"https://api.github.com/users/suuhv/following{/other_user}","gists_url":"https://api.github.com/users/suuhv/gists{/gist_id}","starred_url":"https://api.github.com/users/suuhv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suuhv/subscriptions","organizations_url":"https://api.github.com/users/suuhv/orgs","repos_url":"https://api.github.com/users/suuhv/repos","events_url":"https://api.github.com/users/suuhv/events{/privacy}","received_events_url":"https://api.github.com/users/suuhv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suuhv/Framgia-railstutorial","description":null,"fork":false,"url":"https://api.github.com/repos/suuhv/Framgia-railstutorial","forks_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/forks","keys_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/teams","hooks_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/hooks","issue_events_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/events{/number}","events_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/events","assignees_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/assignees{/user}","branches_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/branches{/branch}","tags_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/tags","blobs_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/refs{/sha}","trees_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/statuses/{sha}","languages_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/languages","stargazers_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/stargazers","contributors_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/contributors","subscribers_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/subscribers","subscription_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/subscription","commits_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/commits{/sha}","git_commits_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/commits{/sha}","comments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/comments{/number}","issue_comment_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/comments{/number}","contents_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/contents/{+path}","compare_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/merges","archive_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/downloads","issues_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues{/number}","pulls_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls{/number}","milestones_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/milestones{/number}","notifications_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/labels{/name}","releases_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/releases{/id}","deployments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/deployments","created_at":"2017-06-01T00:57:49Z","updated_at":"2017-06-01T01:13:26Z","pushed_at":"2017-06-21T07:11:23Z","git_url":"git://github.com/suuhv/Framgia-railstutorial.git","ssh_url":"git@github.com:suuhv/Framgia-railstutorial.git","clone_url":"https://github.com/suuhv/Framgia-railstutorial.git","svn_url":"https://github.com/suuhv/Framgia-railstutorial","homepage":null,"size":91,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"suuhv:master","ref":"master","sha":"4e18d14324c02b4c12bb03e24a56aa88cc21449d","user":{"login":"suuhv","id":14865575,"avatar_url":"https://avatars3.githubusercontent.com/u/14865575?v=3","gravatar_id":"","url":"https://api.github.com/users/suuhv","html_url":"https://github.com/suuhv","followers_url":"https://api.github.com/users/suuhv/followers","following_url":"https://api.github.com/users/suuhv/following{/other_user}","gists_url":"https://api.github.com/users/suuhv/gists{/gist_id}","starred_url":"https://api.github.com/users/suuhv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suuhv/subscriptions","organizations_url":"https://api.github.com/users/suuhv/orgs","repos_url":"https://api.github.com/users/suuhv/repos","events_url":"https://api.github.com/users/suuhv/events{/privacy}","received_events_url":"https://api.github.com/users/suuhv/received_events","type":"User","site_admin":false},"repo":{"id":93001965,"name":"Framgia-railstutorial","full_name":"suuhv/Framgia-railstutorial","owner":{"login":"suuhv","id":14865575,"avatar_url":"https://avatars3.githubusercontent.com/u/14865575?v=3","gravatar_id":"","url":"https://api.github.com/users/suuhv","html_url":"https://github.com/suuhv","followers_url":"https://api.github.com/users/suuhv/followers","following_url":"https://api.github.com/users/suuhv/following{/other_user}","gists_url":"https://api.github.com/users/suuhv/gists{/gist_id}","starred_url":"https://api.github.com/users/suuhv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suuhv/subscriptions","organizations_url":"https://api.github.com/users/suuhv/orgs","repos_url":"https://api.github.com/users/suuhv/repos","events_url":"https://api.github.com/users/suuhv/events{/privacy}","received_events_url":"https://api.github.com/users/suuhv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suuhv/Framgia-railstutorial","description":null,"fork":false,"url":"https://api.github.com/repos/suuhv/Framgia-railstutorial","forks_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/forks","keys_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/teams","hooks_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/hooks","issue_events_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/events{/number}","events_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/events","assignees_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/assignees{/user}","branches_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/branches{/branch}","tags_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/tags","blobs_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/refs{/sha}","trees_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/statuses/{sha}","languages_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/languages","stargazers_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/stargazers","contributors_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/contributors","subscribers_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/subscribers","subscription_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/subscription","commits_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/commits{/sha}","git_commits_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/git/commits{/sha}","comments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/comments{/number}","issue_comment_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/comments{/number}","contents_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/contents/{+path}","compare_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/merges","archive_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/downloads","issues_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues{/number}","pulls_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls{/number}","milestones_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/milestones{/number}","notifications_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/labels{/name}","releases_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/releases{/id}","deployments_url":"https://api.github.com/repos/suuhv/Framgia-railstutorial/deployments","created_at":"2017-06-01T00:57:49Z","updated_at":"2017-06-01T01:13:26Z","pushed_at":"2017-06-21T07:11:23Z","git_url":"git://github.com/suuhv/Framgia-railstutorial.git","ssh_url":"git@github.com:suuhv/Framgia-railstutorial.git","clone_url":"https://github.com/suuhv/Framgia-railstutorial.git","svn_url":"https://github.com/suuhv/Framgia-railstutorial","homepage":null,"size":91,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9"},"html":{"href":"https://github.com/suuhv/Framgia-railstutorial/pull/9"},"issue":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/9"},"comments":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/suuhv/Framgia-railstutorial/statuses/ac324dbbbb00dbe489c1b353847cdab785b58a0c"}}}}
{"actor":{"display_login":"hungnh103"}}