{"action":"created","comment":{"url":"https://api.github.com/repos/openstax/accounts/pulls/comments/35361883","id":35361883,"diff_hunk":"@@ -42,5 +45,28 @@ def get_user\n       @user = User.find(params[:id])\n     end\n \n+    def add_email_to_user\n+      result = AddEmailToUser.call(params[:user][:email_address], @user)\n+      return true unless result.errors.any?\n+      flash[:alert] = \"Failed to add new email address: #{result.errors.collect(&:translate)}\"\n+      return false\n+    end\n+\n+    def change_user_password\n+      return true if params[:user][:password].blank? && params[:user][:password_confirmation].blank?\n+\n+      @user.identity.password = params[:user][:password]\n+      @user.identity.password_confirmation = params[:user][:password_confirmation]\n+      return true if @user.identity.save\n+      flash[:alert] = \"Failed to change password: #{@user.identity.errors.full_messages}\"\n+      return false\n+    end\n+\n+    def update_user(processed_keys)\n+      @user.is_administrator = params[:user][:is_administrator]\n+\n+      user_params = params[:user].select { |k, v| !processed_keys.include?(k.to_sym) }","path":"app/controllers/admin/users_controller.rb","position":38,"original_position":38,"commit_id":"6d9aa7f943d19bf2c5eb2cc4fb15fc929b8703f9","original_commit_id":"6d9aa7f943d19bf2c5eb2cc4fb15fc929b8703f9","user":{"login":"karenc","id":153353,"avatar_url":"https://avatars.githubusercontent.com/u/153353?v=3","gravatar_id":"","url":"https://api.github.com/users/karenc","html_url":"https://github.com/karenc","followers_url":"https://api.github.com/users/karenc/followers","following_url":"https://api.github.com/users/karenc/following{/other_user}","gists_url":"https://api.github.com/users/karenc/gists{/gist_id}","starred_url":"https://api.github.com/users/karenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karenc/subscriptions","organizations_url":"https://api.github.com/users/karenc/orgs","repos_url":"https://api.github.com/users/karenc/repos","events_url":"https://api.github.com/users/karenc/events{/privacy}","received_events_url":"https://api.github.com/users/karenc/received_events","type":"User","site_admin":false},"body":"Oh excellent, let me change that.","created_at":"2015-07-23T19:33:43Z","updated_at":"2015-07-23T19:33:43Z","html_url":"https://github.com/openstax/accounts/pull/182#discussion_r35361883","pull_request_url":"https://api.github.com/repos/openstax/accounts/pulls/182","_links":{"self":{"href":"https://api.github.com/repos/openstax/accounts/pulls/comments/35361883"},"html":{"href":"https://github.com/openstax/accounts/pull/182#discussion_r35361883"},"pull_request":{"href":"https://api.github.com/repos/openstax/accounts/pulls/182"}}},"pull_request":{"url":"https://api.github.com/repos/openstax/accounts/pulls/182","id":40691880,"html_url":"https://github.com/openstax/accounts/pull/182","diff_url":"https://github.com/openstax/accounts/pull/182.diff","patch_url":"https://github.com/openstax/accounts/pull/182.patch","issue_url":"https://api.github.com/repos/openstax/accounts/issues/182","number":182,"state":"open","locked":false,"title":"Admin edit user page","user":{"login":"karenc","id":153353,"avatar_url":"https://avatars.githubusercontent.com/u/153353?v=3","gravatar_id":"","url":"https://api.github.com/users/karenc","html_url":"https://github.com/karenc","followers_url":"https://api.github.com/users/karenc/followers","following_url":"https://api.github.com/users/karenc/following{/other_user}","gists_url":"https://api.github.com/users/karenc/gists{/gist_id}","starred_url":"https://api.github.com/users/karenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karenc/subscriptions","organizations_url":"https://api.github.com/users/karenc/orgs","repos_url":"https://api.github.com/users/karenc/repos","events_url":"https://api.github.com/users/karenc/events{/privacy}","received_events_url":"https://api.github.com/users/karenc/received_events","type":"User","site_admin":false},"body":"![Screenshot](https://cloud.githubusercontent.com/assets/153353/8857558/4f352e8e-316a-11e5-8e3a-cd263b39d819.jpg)\r\n\r\n- Move user search column \"Sign in as\" to right most column\r\n\r\n\r\n- Add \"edit\" to actions on admin user search page\r\n\r\n\r\n- Fix existing admin edit user form so it displays without errors\r\n\r\n  - Add app/views/shared/_error_messages.html.erb\r\n  - User can now have multiple email addresses, change @user.email to\r\n    @user.email_addresses\r\n  - Change is_admin field to is_administrator\r\n  - Change @user.is_disabled? to !@user.is_activated?\r\n  - Remove undefined variable \"submit_classes\"\r\n\r\n- Change admin edit user page to use bootstrap styles\r\n\r\n\r\n- Add verify email button in admin edit user page\r\n\r\n\r\n- Add controller tests for admin verifying user email addresses\r\n\r\n\r\n- Remove \"Disable Account?\" checkbox from admin edit user form\r\n\r\n\r\n- Add first/last/full names and new email address to admin user edit form\r\n\r\n  - Add code to admin users controller #update so it now saves the data\r\n    when the form is submitted\r\n  - Remove \"show\" and \"back\" links from admin user edit page, instead\r\n    opens a new browser tab when the user wants to edit a user\r\n\r\n- Add user edit tests for admin users controller\r\n\r\n- Add password fields to admin user edit form\r\n\r\n- Add update password tests for admin users controller","created_at":"2015-07-23T16:35:28Z","updated_at":"2015-07-23T19:33:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cac232e8fe3ac2e384592aebb9d9603eb171efc8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openstax/accounts/pulls/182/commits","review_comments_url":"https://api.github.com/repos/openstax/accounts/pulls/182/comments","review_comment_url":"https://api.github.com/repos/openstax/accounts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openstax/accounts/issues/182/comments","statuses_url":"https://api.github.com/repos/openstax/accounts/statuses/6d9aa7f943d19bf2c5eb2cc4fb15fc929b8703f9","head":{"label":"openstax:edit-user","ref":"edit-user","sha":"6d9aa7f943d19bf2c5eb2cc4fb15fc929b8703f9","user":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"repo":{"id":11300066,"name":"accounts","full_name":"openstax/accounts","owner":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openstax/accounts","description":"OpenStax centralized authentication and accounts service","fork":false,"url":"https://api.github.com/repos/openstax/accounts","forks_url":"https://api.github.com/repos/openstax/accounts/forks","keys_url":"https://api.github.com/repos/openstax/accounts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openstax/accounts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openstax/accounts/teams","hooks_url":"https://api.github.com/repos/openstax/accounts/hooks","issue_events_url":"https://api.github.com/repos/openstax/accounts/issues/events{/number}","events_url":"https://api.github.com/repos/openstax/accounts/events","assignees_url":"https://api.github.com/repos/openstax/accounts/assignees{/user}","branches_url":"https://api.github.com/repos/openstax/accounts/branches{/branch}","tags_url":"https://api.github.com/repos/openstax/accounts/tags","blobs_url":"https://api.github.com/repos/openstax/accounts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openstax/accounts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openstax/accounts/git/refs{/sha}","trees_url":"https://api.github.com/repos/openstax/accounts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openstax/accounts/statuses/{sha}","languages_url":"https://api.github.com/repos/openstax/accounts/languages","stargazers_url":"https://api.github.com/repos/openstax/accounts/stargazers","contributors_url":"https://api.github.com/repos/openstax/accounts/contributors","subscribers_url":"https://api.github.com/repos/openstax/accounts/subscribers","subscription_url":"https://api.github.com/repos/openstax/accounts/subscription","commits_url":"https://api.github.com/repos/openstax/accounts/commits{/sha}","git_commits_url":"https://api.github.com/repos/openstax/accounts/git/commits{/sha}","comments_url":"https://api.github.com/repos/openstax/accounts/comments{/number}","issue_comment_url":"https://api.github.com/repos/openstax/accounts/issues/comments{/number}","contents_url":"https://api.github.com/repos/openstax/accounts/contents/{+path}","compare_url":"https://api.github.com/repos/openstax/accounts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openstax/accounts/merges","archive_url":"https://api.github.com/repos/openstax/accounts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openstax/accounts/downloads","issues_url":"https://api.github.com/repos/openstax/accounts/issues{/number}","pulls_url":"https://api.github.com/repos/openstax/accounts/pulls{/number}","milestones_url":"https://api.github.com/repos/openstax/accounts/milestones{/number}","notifications_url":"https://api.github.com/repos/openstax/accounts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openstax/accounts/labels{/name}","releases_url":"https://api.github.com/repos/openstax/accounts/releases{/id}","created_at":"2013-07-10T02:36:07Z","updated_at":"2015-04-14T20:49:22Z","pushed_at":"2015-07-23T17:48:30Z","git_url":"git://github.com/openstax/accounts.git","ssh_url":"git@github.com:openstax/accounts.git","clone_url":"https://github.com/openstax/accounts.git","svn_url":"https://github.com/openstax/accounts","homepage":"","size":1981,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":31,"forks":5,"open_issues":31,"watchers":3,"default_branch":"master"}},"base":{"label":"openstax:master","ref":"master","sha":"35344542842b378baffc7a34e64a708f8fdc1183","user":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"repo":{"id":11300066,"name":"accounts","full_name":"openstax/accounts","owner":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openstax/accounts","description":"OpenStax centralized authentication and accounts service","fork":false,"url":"https://api.github.com/repos/openstax/accounts","forks_url":"https://api.github.com/repos/openstax/accounts/forks","keys_url":"https://api.github.com/repos/openstax/accounts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openstax/accounts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openstax/accounts/teams","hooks_url":"https://api.github.com/repos/openstax/accounts/hooks","issue_events_url":"https://api.github.com/repos/openstax/accounts/issues/events{/number}","events_url":"https://api.github.com/repos/openstax/accounts/events","assignees_url":"https://api.github.com/repos/openstax/accounts/assignees{/user}","branches_url":"https://api.github.com/repos/openstax/accounts/branches{/branch}","tags_url":"https://api.github.com/repos/openstax/accounts/tags","blobs_url":"https://api.github.com/repos/openstax/accounts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openstax/accounts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openstax/accounts/git/refs{/sha}","trees_url":"https://api.github.com/repos/openstax/accounts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openstax/accounts/statuses/{sha}","languages_url":"https://api.github.com/repos/openstax/accounts/languages","stargazers_url":"https://api.github.com/repos/openstax/accounts/stargazers","contributors_url":"https://api.github.com/repos/openstax/accounts/contributors","subscribers_url":"https://api.github.com/repos/openstax/accounts/subscribers","subscription_url":"https://api.github.com/repos/openstax/accounts/subscription","commits_url":"https://api.github.com/repos/openstax/accounts/commits{/sha}","git_commits_url":"https://api.github.com/repos/openstax/accounts/git/commits{/sha}","comments_url":"https://api.github.com/repos/openstax/accounts/comments{/number}","issue_comment_url":"https://api.github.com/repos/openstax/accounts/issues/comments{/number}","contents_url":"https://api.github.com/repos/openstax/accounts/contents/{+path}","compare_url":"https://api.github.com/repos/openstax/accounts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openstax/accounts/merges","archive_url":"https://api.github.com/repos/openstax/accounts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openstax/accounts/downloads","issues_url":"https://api.github.com/repos/openstax/accounts/issues{/number}","pulls_url":"https://api.github.com/repos/openstax/accounts/pulls{/number}","milestones_url":"https://api.github.com/repos/openstax/accounts/milestones{/number}","notifications_url":"https://api.github.com/repos/openstax/accounts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openstax/accounts/labels{/name}","releases_url":"https://api.github.com/repos/openstax/accounts/releases{/id}","created_at":"2013-07-10T02:36:07Z","updated_at":"2015-04-14T20:49:22Z","pushed_at":"2015-07-23T17:48:30Z","git_url":"git://github.com/openstax/accounts.git","ssh_url":"git@github.com:openstax/accounts.git","clone_url":"https://github.com/openstax/accounts.git","svn_url":"https://github.com/openstax/accounts","homepage":"","size":1981,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":31,"forks":5,"open_issues":31,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openstax/accounts/pulls/182"},"html":{"href":"https://github.com/openstax/accounts/pull/182"},"issue":{"href":"https://api.github.com/repos/openstax/accounts/issues/182"},"comments":{"href":"https://api.github.com/repos/openstax/accounts/issues/182/comments"},"review_comments":{"href":"https://api.github.com/repos/openstax/accounts/pulls/182/comments"},"review_comment":{"href":"https://api.github.com/repos/openstax/accounts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openstax/accounts/pulls/182/commits"},"statuses":{"href":"https://api.github.com/repos/openstax/accounts/statuses/6d9aa7f943d19bf2c5eb2cc4fb15fc929b8703f9"}}}}