{"action":"created","comment":{"url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/comments/228171264","pull_request_review_id":168379261,"id":228171264,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODE3MTI2NA==","diff_hunk":"@@ -0,0 +1,137 @@\n+module Api\n+  module V1\n+    class PasswordsController < DeviseTokenAuth::PasswordsController\n+      before_action :set_user_by_token, only: [:update]\n+      skip_after_action :update_auth_header, only: %i[create edit]\n+\n+      # this is where users arrive after visiting the password reset confirmation link\n+      def edit\n+        # if a user is not found, return nil\n+        @resource = with_reset_password_token(resource_params[:reset_password_token])\n+        if @resource&.reset_password_period_valid?\n+          client_id, token = @resource.create_token\n+          resource_config_and_save\n+\n+          yield @resource if block_given?\n+\n+          render_edit_success(client_id, token)\n+        else\n+          render_edit_error\n+        end\n+      end\n+\n+      private\n+\n+      def resource_config_and_save\n+        @resource.skip_confirmation! if confirmable_enabled? && !@resource.confirmed_at\n+        @resource.allow_password_change = true if recoverable_enabled?\n+        @resource.save!\n+      end\n+\n+      def render_edit_success(client_id, token)\n+        user_email = @resource.email\n+        response_header_options = { reset_password: true }\n+        response_headers = build_redirect_headers(token,\n+                                                  client_id,\n+                                                  response_header_options)\n+        response.header.merge!(\n+          'access-token' => response_headers['access-token'],\n+          'client' => response_headers['client'],\n+          'uid' => user_email\n+        )\n+        render json: { email: user_email }, status: :ok\n+      end\n+\n+      def resource_update_method\n+        allow_password_change = recoverable_enabled? && @resource.allow_password_change == true\n+        if DeviseTokenAuth.check_current_password_before_update == false || allow_password_change\n+          'update_attributes'\n+        else\n+          'update_with_password'\n+        end\n+      end\n+\n+      def render_create_error_missing_email\n+        render_error(401, I18n.t('devise_token_auth.passwords.missing_email'))\n+      end\n+\n+      def render_create_error_missing_redirect_url\n+        render_error(401, I18n.t('devise_token_auth.passwords.missing_redirect_url'))\n+      end\n+\n+      def render_create_error_not_allowed_redirect_url\n+        response = {\n+          status: 'error',\n+          data:   resource_data\n+        }\n+        message = I18n.t('devise_token_auth.passwords.not_allowed_redirect_url',\n+                         redirect_url: @redirect_url)\n+        render_error(422, message, response)\n+      end\n+\n+      def render_create_success\n+        render json: {\n+          success: true,\n+          message: I18n.t('devise_token_auth.passwords.sended', email: @email)\n+        }\n+      end\n+\n+      def render_create_error(errors)\n+        render json: {\n+          success: false,\n+          errors: errors\n+        }, status: 400\n+      end\n+\n+      def render_edit_error\n+        render_error(404, 'Not Found')","path":"app/controllers/api/v1/passwords_controller.rb","position":87,"original_position":87,"commit_id":"e80fd1e54d6bef6924d6c9d2512ed45f19e024db","original_commit_id":"e80fd1e54d6bef6924d6c9d2512ed45f19e024db","user":{"login":"jdrosales17","id":28100343,"node_id":"MDQ6VXNlcjI4MTAwMzQz","avatar_url":"https://avatars3.githubusercontent.com/u/28100343?v=4","gravatar_id":"","url":"https://api.github.com/users/jdrosales17","html_url":"https://github.com/jdrosales17","followers_url":"https://api.github.com/users/jdrosales17/followers","following_url":"https://api.github.com/users/jdrosales17/following{/other_user}","gists_url":"https://api.github.com/users/jdrosales17/gists{/gist_id}","starred_url":"https://api.github.com/users/jdrosales17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdrosales17/subscriptions","organizations_url":"https://api.github.com/users/jdrosales17/orgs","repos_url":"https://api.github.com/users/jdrosales17/repos","events_url":"https://api.github.com/users/jdrosales17/events{/privacy}","received_events_url":"https://api.github.com/users/jdrosales17/received_events","type":"User","site_admin":false},"body":"Use i18n here and update tests that check this error message","created_at":"2018-10-25T13:26:00Z","updated_at":"2018-10-25T13:30:46Z","html_url":"https://github.com/andresg4/target_mvd_api/pull/6#discussion_r228171264","pull_request_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/comments/228171264"},"html":{"href":"https://github.com/andresg4/target_mvd_api/pull/6#discussion_r228171264"},"pull_request":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6","id":225490786,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1NDkwNzg2","html_url":"https://github.com/andresg4/target_mvd_api/pull/6","diff_url":"https://github.com/andresg4/target_mvd_api/pull/6.diff","patch_url":"https://github.com/andresg4/target_mvd_api/pull/6.patch","issue_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/6","number":6,"state":"open","locked":false,"title":"Added reset forgotten password","user":{"login":"andresg4","id":21186648,"node_id":"MDQ6VXNlcjIxMTg2NjQ4","avatar_url":"https://avatars3.githubusercontent.com/u/21186648?v=4","gravatar_id":"","url":"https://api.github.com/users/andresg4","html_url":"https://github.com/andresg4","followers_url":"https://api.github.com/users/andresg4/followers","following_url":"https://api.github.com/users/andresg4/following{/other_user}","gists_url":"https://api.github.com/users/andresg4/gists{/gist_id}","starred_url":"https://api.github.com/users/andresg4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresg4/subscriptions","organizations_url":"https://api.github.com/users/andresg4/orgs","repos_url":"https://api.github.com/users/andresg4/repos","events_url":"https://api.github.com/users/andresg4/events{/privacy}","received_events_url":"https://api.github.com/users/andresg4/received_events","type":"User","site_admin":false},"body":"## TASKS\r\n- [X] Created passwords controller.\r\n- [X] Configured routes.\r\n\r\n## NOTES\r\n- [X] When front-end starts working on this, changes may have to be made to this.","created_at":"2018-10-24T17:38:53Z","updated_at":"2018-10-25T13:30:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c40fecd51e7d6ce6745e94cef1be2f2501f892c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"matiasmansilla1989","id":5650396,"node_id":"MDQ6VXNlcjU2NTAzOTY=","avatar_url":"https://avatars0.githubusercontent.com/u/5650396?v=4","gravatar_id":"","url":"https://api.github.com/users/matiasmansilla1989","html_url":"https://github.com/matiasmansilla1989","followers_url":"https://api.github.com/users/matiasmansilla1989/followers","following_url":"https://api.github.com/users/matiasmansilla1989/following{/other_user}","gists_url":"https://api.github.com/users/matiasmansilla1989/gists{/gist_id}","starred_url":"https://api.github.com/users/matiasmansilla1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matiasmansilla1989/subscriptions","organizations_url":"https://api.github.com/users/matiasmansilla1989/orgs","repos_url":"https://api.github.com/users/matiasmansilla1989/repos","events_url":"https://api.github.com/users/matiasmansilla1989/events{/privacy}","received_events_url":"https://api.github.com/users/matiasmansilla1989/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6/commits","review_comments_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6/comments","review_comment_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/6/comments","statuses_url":"https://api.github.com/repos/andresg4/target_mvd_api/statuses/e80fd1e54d6bef6924d6c9d2512ed45f19e024db","head":{"label":"andresg4:feature/reset_password","ref":"feature/reset_password","sha":"e80fd1e54d6bef6924d6c9d2512ed45f19e024db","user":{"login":"andresg4","id":21186648,"node_id":"MDQ6VXNlcjIxMTg2NjQ4","avatar_url":"https://avatars3.githubusercontent.com/u/21186648?v=4","gravatar_id":"","url":"https://api.github.com/users/andresg4","html_url":"https://github.com/andresg4","followers_url":"https://api.github.com/users/andresg4/followers","following_url":"https://api.github.com/users/andresg4/following{/other_user}","gists_url":"https://api.github.com/users/andresg4/gists{/gist_id}","starred_url":"https://api.github.com/users/andresg4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresg4/subscriptions","organizations_url":"https://api.github.com/users/andresg4/orgs","repos_url":"https://api.github.com/users/andresg4/repos","events_url":"https://api.github.com/users/andresg4/events{/privacy}","received_events_url":"https://api.github.com/users/andresg4/received_events","type":"User","site_admin":false},"repo":{"id":152091569,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIwOTE1Njk=","name":"target_mvd_api","full_name":"andresg4/target_mvd_api","private":false,"owner":{"login":"andresg4","id":21186648,"node_id":"MDQ6VXNlcjIxMTg2NjQ4","avatar_url":"https://avatars3.githubusercontent.com/u/21186648?v=4","gravatar_id":"","url":"https://api.github.com/users/andresg4","html_url":"https://github.com/andresg4","followers_url":"https://api.github.com/users/andresg4/followers","following_url":"https://api.github.com/users/andresg4/following{/other_user}","gists_url":"https://api.github.com/users/andresg4/gists{/gist_id}","starred_url":"https://api.github.com/users/andresg4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresg4/subscriptions","organizations_url":"https://api.github.com/users/andresg4/orgs","repos_url":"https://api.github.com/users/andresg4/repos","events_url":"https://api.github.com/users/andresg4/events{/privacy}","received_events_url":"https://api.github.com/users/andresg4/received_events","type":"User","site_admin":false},"html_url":"https://github.com/andresg4/target_mvd_api","description":null,"fork":false,"url":"https://api.github.com/repos/andresg4/target_mvd_api","forks_url":"https://api.github.com/repos/andresg4/target_mvd_api/forks","keys_url":"https://api.github.com/repos/andresg4/target_mvd_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andresg4/target_mvd_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andresg4/target_mvd_api/teams","hooks_url":"https://api.github.com/repos/andresg4/target_mvd_api/hooks","issue_events_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/events{/number}","events_url":"https://api.github.com/repos/andresg4/target_mvd_api/events","assignees_url":"https://api.github.com/repos/andresg4/target_mvd_api/assignees{/user}","branches_url":"https://api.github.com/repos/andresg4/target_mvd_api/branches{/branch}","tags_url":"https://api.github.com/repos/andresg4/target_mvd_api/tags","blobs_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andresg4/target_mvd_api/statuses/{sha}","languages_url":"https://api.github.com/repos/andresg4/target_mvd_api/languages","stargazers_url":"https://api.github.com/repos/andresg4/target_mvd_api/stargazers","contributors_url":"https://api.github.com/repos/andresg4/target_mvd_api/contributors","subscribers_url":"https://api.github.com/repos/andresg4/target_mvd_api/subscribers","subscription_url":"https://api.github.com/repos/andresg4/target_mvd_api/subscription","commits_url":"https://api.github.com/repos/andresg4/target_mvd_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/andresg4/target_mvd_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/andresg4/target_mvd_api/contents/{+path}","compare_url":"https://api.github.com/repos/andresg4/target_mvd_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andresg4/target_mvd_api/merges","archive_url":"https://api.github.com/repos/andresg4/target_mvd_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andresg4/target_mvd_api/downloads","issues_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues{/number}","pulls_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls{/number}","milestones_url":"https://api.github.com/repos/andresg4/target_mvd_api/milestones{/number}","notifications_url":"https://api.github.com/repos/andresg4/target_mvd_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andresg4/target_mvd_api/labels{/name}","releases_url":"https://api.github.com/repos/andresg4/target_mvd_api/releases{/id}","deployments_url":"https://api.github.com/repos/andresg4/target_mvd_api/deployments","created_at":"2018-10-08T14:13:53Z","updated_at":"2018-10-22T15:35:34Z","pushed_at":"2018-10-24T18:06:42Z","git_url":"git://github.com/andresg4/target_mvd_api.git","ssh_url":"git@github.com:andresg4/target_mvd_api.git","clone_url":"https://github.com/andresg4/target_mvd_api.git","svn_url":"https://github.com/andresg4/target_mvd_api","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,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"andresg4:develop","ref":"develop","sha":"6cd101ad9ea738bf8298128e64142338956e324b","user":{"login":"andresg4","id":21186648,"node_id":"MDQ6VXNlcjIxMTg2NjQ4","avatar_url":"https://avatars3.githubusercontent.com/u/21186648?v=4","gravatar_id":"","url":"https://api.github.com/users/andresg4","html_url":"https://github.com/andresg4","followers_url":"https://api.github.com/users/andresg4/followers","following_url":"https://api.github.com/users/andresg4/following{/other_user}","gists_url":"https://api.github.com/users/andresg4/gists{/gist_id}","starred_url":"https://api.github.com/users/andresg4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresg4/subscriptions","organizations_url":"https://api.github.com/users/andresg4/orgs","repos_url":"https://api.github.com/users/andresg4/repos","events_url":"https://api.github.com/users/andresg4/events{/privacy}","received_events_url":"https://api.github.com/users/andresg4/received_events","type":"User","site_admin":false},"repo":{"id":152091569,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIwOTE1Njk=","name":"target_mvd_api","full_name":"andresg4/target_mvd_api","private":false,"owner":{"login":"andresg4","id":21186648,"node_id":"MDQ6VXNlcjIxMTg2NjQ4","avatar_url":"https://avatars3.githubusercontent.com/u/21186648?v=4","gravatar_id":"","url":"https://api.github.com/users/andresg4","html_url":"https://github.com/andresg4","followers_url":"https://api.github.com/users/andresg4/followers","following_url":"https://api.github.com/users/andresg4/following{/other_user}","gists_url":"https://api.github.com/users/andresg4/gists{/gist_id}","starred_url":"https://api.github.com/users/andresg4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresg4/subscriptions","organizations_url":"https://api.github.com/users/andresg4/orgs","repos_url":"https://api.github.com/users/andresg4/repos","events_url":"https://api.github.com/users/andresg4/events{/privacy}","received_events_url":"https://api.github.com/users/andresg4/received_events","type":"User","site_admin":false},"html_url":"https://github.com/andresg4/target_mvd_api","description":null,"fork":false,"url":"https://api.github.com/repos/andresg4/target_mvd_api","forks_url":"https://api.github.com/repos/andresg4/target_mvd_api/forks","keys_url":"https://api.github.com/repos/andresg4/target_mvd_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andresg4/target_mvd_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andresg4/target_mvd_api/teams","hooks_url":"https://api.github.com/repos/andresg4/target_mvd_api/hooks","issue_events_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/events{/number}","events_url":"https://api.github.com/repos/andresg4/target_mvd_api/events","assignees_url":"https://api.github.com/repos/andresg4/target_mvd_api/assignees{/user}","branches_url":"https://api.github.com/repos/andresg4/target_mvd_api/branches{/branch}","tags_url":"https://api.github.com/repos/andresg4/target_mvd_api/tags","blobs_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andresg4/target_mvd_api/statuses/{sha}","languages_url":"https://api.github.com/repos/andresg4/target_mvd_api/languages","stargazers_url":"https://api.github.com/repos/andresg4/target_mvd_api/stargazers","contributors_url":"https://api.github.com/repos/andresg4/target_mvd_api/contributors","subscribers_url":"https://api.github.com/repos/andresg4/target_mvd_api/subscribers","subscription_url":"https://api.github.com/repos/andresg4/target_mvd_api/subscription","commits_url":"https://api.github.com/repos/andresg4/target_mvd_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/andresg4/target_mvd_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/andresg4/target_mvd_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/andresg4/target_mvd_api/contents/{+path}","compare_url":"https://api.github.com/repos/andresg4/target_mvd_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andresg4/target_mvd_api/merges","archive_url":"https://api.github.com/repos/andresg4/target_mvd_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andresg4/target_mvd_api/downloads","issues_url":"https://api.github.com/repos/andresg4/target_mvd_api/issues{/number}","pulls_url":"https://api.github.com/repos/andresg4/target_mvd_api/pulls{/number}","milestones_url":"https://api.github.com/repos/andresg4/target_mvd_api/milestones{/number}","notifications_url":"https://api.github.com/repos/andresg4/target_mvd_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andresg4/target_mvd_api/labels{/name}","releases_url":"https://api.github.com/repos/andresg4/target_mvd_api/releases{/id}","deployments_url":"https://api.github.com/repos/andresg4/target_mvd_api/deployments","created_at":"2018-10-08T14:13:53Z","updated_at":"2018-10-22T15:35:34Z","pushed_at":"2018-10-24T18:06:42Z","git_url":"git://github.com/andresg4/target_mvd_api.git","ssh_url":"git@github.com:andresg4/target_mvd_api.git","clone_url":"https://github.com/andresg4/target_mvd_api.git","svn_url":"https://github.com/andresg4/target_mvd_api","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,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6"},"html":{"href":"https://github.com/andresg4/target_mvd_api/pull/6"},"issue":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/issues/6"},"comments":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/andresg4/target_mvd_api/statuses/e80fd1e54d6bef6924d6c9d2512ed45f19e024db"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jdrosales17"}}