{"action":"created","comment":{"url":"https://api.github.com/repos/porygonco/porybox/pulls/comments/84314210","pull_request_review_id":5099482,"id":84314210,"diff_hunk":"@@ -32,6 +32,40 @@ describe('UserController', () => {\n     expect(res.header.location).to.equal('/api/v1/user/usertester');\n   });\n \n+  describe('forgotten username', () => {\n+    let username, recipientEmailAddress;\n+    before(async () => {\n+      username = 'usernameForgetter';\n+      recipientEmailAddress = 'usernameForgetter@example.com';\n+      const tempAgent = await testHelpers.getAgent();\n+      const res = await tempAgent.post('/api/v1/auth/local/register').send({\n+        name: username,\n+        password: 'Obliviate!',\n+        email: recipientEmailAddress\n+      });\n+      expect(res.statusCode).to.equal(200);\n+    });\n+    describe('when the requested account exists', () => {\n+      it('returns a 202 response and sends a username reminder email to the user', async () => {\n+        const res = await agent.post(`/api/v1/user/${recipientEmailAddress}/forgotUsername`);\n+        expect(res.statusCode).to.equal(202);\n+        expect(res.body).to.eql({});\n+        const email = await new Promise(resolve => testHelpers.emailEmitter.once('email', resolve));\n+        expect(email.sender).to.equal('no-reply@example.org');\n+        expect(email.receivers).to.eql({[recipientEmailAddress]: true});\n+        expect(email.subject).to.equal('[Porybox] Your username');\n+        expect(email.body).to.include(username);\n+      });\n+    });\n+    describe('when the requested account does not exist', () => {\n+      it('returns a 202 message but doesn\\'t send an email', async () => {\n+        // We don't want a user to know if an account exists for a specific email address, as this increases attack vectors\n+        const res = await agent.post(`/api/v1/user/${recipientEmailAddress}.au/forgotUsername`);\n+        expect(res.statusCode).to.equal(202);\n+      });\n+    });\n+  });\n+","path":"test/controller/user.js","position":37,"original_position":37,"commit_id":"372a10d6adc9c5a6836e27adc013552bd05de40b","original_commit_id":"372a10d6adc9c5a6836e27adc013552bd05de40b","user":{"login":"not-an-aardvark","id":11638619,"avatar_url":"https://avatars.githubusercontent.com/u/11638619?v=3","gravatar_id":"","url":"https://api.github.com/users/not-an-aardvark","html_url":"https://github.com/not-an-aardvark","followers_url":"https://api.github.com/users/not-an-aardvark/followers","following_url":"https://api.github.com/users/not-an-aardvark/following{/other_user}","gists_url":"https://api.github.com/users/not-an-aardvark/gists{/gist_id}","starred_url":"https://api.github.com/users/not-an-aardvark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/not-an-aardvark/subscriptions","organizations_url":"https://api.github.com/users/not-an-aardvark/orgs","repos_url":"https://api.github.com/users/not-an-aardvark/repos","events_url":"https://api.github.com/users/not-an-aardvark/events{/privacy}","received_events_url":"https://api.github.com/users/not-an-aardvark/received_events","type":"User","site_admin":false},"body":"Oh, good point. I forgot that the param is in the URL rather than the querystring or something. Never mind then.","created_at":"2016-10-20T15:49:07Z","updated_at":"2016-10-20T15:49:07Z","html_url":"https://github.com/porygonco/porybox/pull/520#discussion_r84314210","pull_request_url":"https://api.github.com/repos/porygonco/porybox/pulls/520","_links":{"self":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/comments/84314210"},"html":{"href":"https://github.com/porygonco/porybox/pull/520#discussion_r84314210"},"pull_request":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/520"}}},"pull_request":{"url":"https://api.github.com/repos/porygonco/porybox/pulls/520","id":90026562,"html_url":"https://github.com/porygonco/porybox/pull/520","diff_url":"https://github.com/porygonco/porybox/pull/520.diff","patch_url":"https://github.com/porygonco/porybox/pull/520.patch","issue_url":"https://api.github.com/repos/porygonco/porybox/issues/520","number":520,"state":"open","locked":false,"title":"Add lost username endpoint","user":{"login":"YaManicKill","id":2162657,"avatar_url":"https://avatars.githubusercontent.com/u/2162657?v=3","gravatar_id":"","url":"https://api.github.com/users/YaManicKill","html_url":"https://github.com/YaManicKill","followers_url":"https://api.github.com/users/YaManicKill/followers","following_url":"https://api.github.com/users/YaManicKill/following{/other_user}","gists_url":"https://api.github.com/users/YaManicKill/gists{/gist_id}","starred_url":"https://api.github.com/users/YaManicKill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YaManicKill/subscriptions","organizations_url":"https://api.github.com/users/YaManicKill/orgs","repos_url":"https://api.github.com/users/YaManicKill/repos","events_url":"https://api.github.com/users/YaManicKill/events{/privacy}","received_events_url":"https://api.github.com/users/YaManicKill/received_events","type":"User","site_admin":false},"body":"Fixes #10","created_at":"2016-10-19T14:55:38Z","updated_at":"2016-10-20T15:49:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f830ece887a1c8d5b808d1ac6fc0fb1a7f1b29b2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/porygonco/porybox/pulls/520/commits","review_comments_url":"https://api.github.com/repos/porygonco/porybox/pulls/520/comments","review_comment_url":"https://api.github.com/repos/porygonco/porybox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/porygonco/porybox/issues/520/comments","statuses_url":"https://api.github.com/repos/porygonco/porybox/statuses/372a10d6adc9c5a6836e27adc013552bd05de40b","head":{"label":"porygonco:10-lost-username","ref":"10-lost-username","sha":"372a10d6adc9c5a6836e27adc013552bd05de40b","user":{"login":"porygonco","id":17102765,"avatar_url":"https://avatars.githubusercontent.com/u/17102765?v=3","gravatar_id":"","url":"https://api.github.com/users/porygonco","html_url":"https://github.com/porygonco","followers_url":"https://api.github.com/users/porygonco/followers","following_url":"https://api.github.com/users/porygonco/following{/other_user}","gists_url":"https://api.github.com/users/porygonco/gists{/gist_id}","starred_url":"https://api.github.com/users/porygonco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porygonco/subscriptions","organizations_url":"https://api.github.com/users/porygonco/orgs","repos_url":"https://api.github.com/users/porygonco/repos","events_url":"https://api.github.com/users/porygonco/events{/privacy}","received_events_url":"https://api.github.com/users/porygonco/received_events","type":"Organization","site_admin":false},"repo":{"id":51261886,"name":"porybox","full_name":"porygonco/porybox","owner":{"login":"porygonco","id":17102765,"avatar_url":"https://avatars.githubusercontent.com/u/17102765?v=3","gravatar_id":"","url":"https://api.github.com/users/porygonco","html_url":"https://github.com/porygonco","followers_url":"https://api.github.com/users/porygonco/followers","following_url":"https://api.github.com/users/porygonco/following{/other_user}","gists_url":"https://api.github.com/users/porygonco/gists{/gist_id}","starred_url":"https://api.github.com/users/porygonco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porygonco/subscriptions","organizations_url":"https://api.github.com/users/porygonco/orgs","repos_url":"https://api.github.com/users/porygonco/repos","events_url":"https://api.github.com/users/porygonco/events{/privacy}","received_events_url":"https://api.github.com/users/porygonco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/porygonco/porybox","description":"Porybox is a platform that allows users to display their Pokémon collections.","fork":false,"url":"https://api.github.com/repos/porygonco/porybox","forks_url":"https://api.github.com/repos/porygonco/porybox/forks","keys_url":"https://api.github.com/repos/porygonco/porybox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/porygonco/porybox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/porygonco/porybox/teams","hooks_url":"https://api.github.com/repos/porygonco/porybox/hooks","issue_events_url":"https://api.github.com/repos/porygonco/porybox/issues/events{/number}","events_url":"https://api.github.com/repos/porygonco/porybox/events","assignees_url":"https://api.github.com/repos/porygonco/porybox/assignees{/user}","branches_url":"https://api.github.com/repos/porygonco/porybox/branches{/branch}","tags_url":"https://api.github.com/repos/porygonco/porybox/tags","blobs_url":"https://api.github.com/repos/porygonco/porybox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/porygonco/porybox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/porygonco/porybox/git/refs{/sha}","trees_url":"https://api.github.com/repos/porygonco/porybox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/porygonco/porybox/statuses/{sha}","languages_url":"https://api.github.com/repos/porygonco/porybox/languages","stargazers_url":"https://api.github.com/repos/porygonco/porybox/stargazers","contributors_url":"https://api.github.com/repos/porygonco/porybox/contributors","subscribers_url":"https://api.github.com/repos/porygonco/porybox/subscribers","subscription_url":"https://api.github.com/repos/porygonco/porybox/subscription","commits_url":"https://api.github.com/repos/porygonco/porybox/commits{/sha}","git_commits_url":"https://api.github.com/repos/porygonco/porybox/git/commits{/sha}","comments_url":"https://api.github.com/repos/porygonco/porybox/comments{/number}","issue_comment_url":"https://api.github.com/repos/porygonco/porybox/issues/comments{/number}","contents_url":"https://api.github.com/repos/porygonco/porybox/contents/{+path}","compare_url":"https://api.github.com/repos/porygonco/porybox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/porygonco/porybox/merges","archive_url":"https://api.github.com/repos/porygonco/porybox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/porygonco/porybox/downloads","issues_url":"https://api.github.com/repos/porygonco/porybox/issues{/number}","pulls_url":"https://api.github.com/repos/porygonco/porybox/pulls{/number}","milestones_url":"https://api.github.com/repos/porygonco/porybox/milestones{/number}","notifications_url":"https://api.github.com/repos/porygonco/porybox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/porygonco/porybox/labels{/name}","releases_url":"https://api.github.com/repos/porygonco/porybox/releases{/id}","deployments_url":"https://api.github.com/repos/porygonco/porybox/deployments","created_at":"2016-02-07T19:25:13Z","updated_at":"2016-09-17T22:11:45Z","pushed_at":"2016-10-20T09:45:57Z","git_url":"git://github.com/porygonco/porybox.git","ssh_url":"git@github.com:porygonco/porybox.git","clone_url":"https://github.com/porygonco/porybox.git","svn_url":"https://github.com/porygonco/porybox","homepage":"https://www.porybox.com","size":11408,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":32,"forks":2,"open_issues":32,"watchers":11,"default_branch":"master"}},"base":{"label":"porygonco:master","ref":"master","sha":"09087ee11b5355fa683b38d852d5e7c36960ad32","user":{"login":"porygonco","id":17102765,"avatar_url":"https://avatars.githubusercontent.com/u/17102765?v=3","gravatar_id":"","url":"https://api.github.com/users/porygonco","html_url":"https://github.com/porygonco","followers_url":"https://api.github.com/users/porygonco/followers","following_url":"https://api.github.com/users/porygonco/following{/other_user}","gists_url":"https://api.github.com/users/porygonco/gists{/gist_id}","starred_url":"https://api.github.com/users/porygonco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porygonco/subscriptions","organizations_url":"https://api.github.com/users/porygonco/orgs","repos_url":"https://api.github.com/users/porygonco/repos","events_url":"https://api.github.com/users/porygonco/events{/privacy}","received_events_url":"https://api.github.com/users/porygonco/received_events","type":"Organization","site_admin":false},"repo":{"id":51261886,"name":"porybox","full_name":"porygonco/porybox","owner":{"login":"porygonco","id":17102765,"avatar_url":"https://avatars.githubusercontent.com/u/17102765?v=3","gravatar_id":"","url":"https://api.github.com/users/porygonco","html_url":"https://github.com/porygonco","followers_url":"https://api.github.com/users/porygonco/followers","following_url":"https://api.github.com/users/porygonco/following{/other_user}","gists_url":"https://api.github.com/users/porygonco/gists{/gist_id}","starred_url":"https://api.github.com/users/porygonco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porygonco/subscriptions","organizations_url":"https://api.github.com/users/porygonco/orgs","repos_url":"https://api.github.com/users/porygonco/repos","events_url":"https://api.github.com/users/porygonco/events{/privacy}","received_events_url":"https://api.github.com/users/porygonco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/porygonco/porybox","description":"Porybox is a platform that allows users to display their Pokémon collections.","fork":false,"url":"https://api.github.com/repos/porygonco/porybox","forks_url":"https://api.github.com/repos/porygonco/porybox/forks","keys_url":"https://api.github.com/repos/porygonco/porybox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/porygonco/porybox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/porygonco/porybox/teams","hooks_url":"https://api.github.com/repos/porygonco/porybox/hooks","issue_events_url":"https://api.github.com/repos/porygonco/porybox/issues/events{/number}","events_url":"https://api.github.com/repos/porygonco/porybox/events","assignees_url":"https://api.github.com/repos/porygonco/porybox/assignees{/user}","branches_url":"https://api.github.com/repos/porygonco/porybox/branches{/branch}","tags_url":"https://api.github.com/repos/porygonco/porybox/tags","blobs_url":"https://api.github.com/repos/porygonco/porybox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/porygonco/porybox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/porygonco/porybox/git/refs{/sha}","trees_url":"https://api.github.com/repos/porygonco/porybox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/porygonco/porybox/statuses/{sha}","languages_url":"https://api.github.com/repos/porygonco/porybox/languages","stargazers_url":"https://api.github.com/repos/porygonco/porybox/stargazers","contributors_url":"https://api.github.com/repos/porygonco/porybox/contributors","subscribers_url":"https://api.github.com/repos/porygonco/porybox/subscribers","subscription_url":"https://api.github.com/repos/porygonco/porybox/subscription","commits_url":"https://api.github.com/repos/porygonco/porybox/commits{/sha}","git_commits_url":"https://api.github.com/repos/porygonco/porybox/git/commits{/sha}","comments_url":"https://api.github.com/repos/porygonco/porybox/comments{/number}","issue_comment_url":"https://api.github.com/repos/porygonco/porybox/issues/comments{/number}","contents_url":"https://api.github.com/repos/porygonco/porybox/contents/{+path}","compare_url":"https://api.github.com/repos/porygonco/porybox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/porygonco/porybox/merges","archive_url":"https://api.github.com/repos/porygonco/porybox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/porygonco/porybox/downloads","issues_url":"https://api.github.com/repos/porygonco/porybox/issues{/number}","pulls_url":"https://api.github.com/repos/porygonco/porybox/pulls{/number}","milestones_url":"https://api.github.com/repos/porygonco/porybox/milestones{/number}","notifications_url":"https://api.github.com/repos/porygonco/porybox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/porygonco/porybox/labels{/name}","releases_url":"https://api.github.com/repos/porygonco/porybox/releases{/id}","deployments_url":"https://api.github.com/repos/porygonco/porybox/deployments","created_at":"2016-02-07T19:25:13Z","updated_at":"2016-09-17T22:11:45Z","pushed_at":"2016-10-20T09:45:57Z","git_url":"git://github.com/porygonco/porybox.git","ssh_url":"git@github.com:porygonco/porybox.git","clone_url":"https://github.com/porygonco/porybox.git","svn_url":"https://github.com/porygonco/porybox","homepage":"https://www.porybox.com","size":11408,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":32,"forks":2,"open_issues":32,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/520"},"html":{"href":"https://github.com/porygonco/porybox/pull/520"},"issue":{"href":"https://api.github.com/repos/porygonco/porybox/issues/520"},"comments":{"href":"https://api.github.com/repos/porygonco/porybox/issues/520/comments"},"review_comments":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/520/comments"},"review_comment":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/porygonco/porybox/pulls/520/commits"},"statuses":{"href":"https://api.github.com/repos/porygonco/porybox/statuses/372a10d6adc9c5a6836e27adc013552bd05de40b"}}}}
{"actor":{"display_login":"not-an-aardvark"}}