{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/comments/24595996","id":24595996,"diff_hunk":"@@ -439,6 +440,54 @@ module.exports = function (\n     )\n   }\n \n+  DB.prototype.lockAccount = function (account) {\n+    var unlockCode = crypto.randomBytes(16).toString('hex');\n+    log.trace({ op: 'DB.lockAccount', uid: account && account.uid, unlockCode: unlockCode })\n+\n+    return this.pool.post(\n+      '/account/' + account.uid.toString('hex') + '/lock',\n+      {\n+        lockedAt: Date.now(),\n+        unlockCode: unlockCode\n+      }\n+    )\n+  }\n+\n+  DB.prototype.unlockAccount = function (account) {\n+    log.trace({ op: 'DB.unlockAccount', uid: account && account.uid })\n+    return this.pool.post(\n+      '/account/' + account.uid.toString('hex') + '/unlock'\n+      )\n+      .then(null,\n+        function (err) {\n+          if (err.statusCode === 404) {\n+            // TODO - throw a better error here.\n+            err = error.unknownAccount()\n+          }\n+          throw err\n+        }\n+      )\n+  }\n+\n+  DB.prototype.unlockCode = function (account) {\n+    log.trace({ op: 'DB.unlockCode', uid: account && account.uid })\n+    return this.pool.get(\n+      '/account/' + account.uid.toString('hex') + '/unlockCode'\n+      )\n+      .then(\n+        function (body) {\n+          return body.unlockCode\n+        },\n+        function (err) {\n+          if (err.statusCode === 404) {\n+            // TODO - throw a better error here.\n+            err = error.unknownAccount()","path":"db/httpdb.js","position":53,"original_position":53,"commit_id":"ce095523add71f25696f4a04ac79f11660a28364","original_commit_id":"634fd4a152b7925607346303d2988997dcd600d6","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":"I am now throwing the `accountNotLocked` error in the [account/unlock/resend_code route](https://github.com/mozilla/fxa-auth-server/pull/867/files#diff-43da5bcdd83eb1d30aa0b5e9e7473834R609).","created_at":"2015-02-12T16:47:59Z","updated_at":"2015-02-12T16:47:59Z","html_url":"https://github.com/mozilla/fxa-auth-server/pull/867#discussion_r24595996","pull_request_url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/comments/24595996"},"html":{"href":"https://github.com/mozilla/fxa-auth-server/pull/867#discussion_r24595996"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867","id":28737569,"html_url":"https://github.com/mozilla/fxa-auth-server/pull/867","diff_url":"https://github.com/mozilla/fxa-auth-server/pull/867.diff","patch_url":"https://github.com/mozilla/fxa-auth-server/pull/867.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/867","number":867,"state":"open","locked":false,"title":"Account lockout","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":"Goes along with:\r\n* https://github.com/mozilla/fxa-auth-db-server/pull/123\r\n* https://github.com/mozilla/fxa-auth-db-mem/pull/11\r\n* https://github.com/mozilla/fxa-auth-db-mysql/pull/7\r\n* https://github.com/mozilla/fxa-js-client/pull/141\r\n* https://github.com/mozilla/fxa-content-server/pull/1806\r\n* https://github.com/mozilla/fxa-auth-mailer/pull/23","created_at":"2015-02-05T16:17:43Z","updated_at":"2015-02-12T16:47:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"885bc7822a350b2bd031f763f6fabf2bdebe8bea","assignee":{"login":"chilts","id":3048,"avatar_url":"https://avatars.githubusercontent.com/u/3048?v=3","gravatar_id":"","url":"https://api.github.com/users/chilts","html_url":"https://github.com/chilts","followers_url":"https://api.github.com/users/chilts/followers","following_url":"https://api.github.com/users/chilts/following{/other_user}","gists_url":"https://api.github.com/users/chilts/gists{/gist_id}","starred_url":"https://api.github.com/users/chilts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilts/subscriptions","organizations_url":"https://api.github.com/users/chilts/orgs","repos_url":"https://api.github.com/users/chilts/repos","events_url":"https://api.github.com/users/chilts/events{/privacy}","received_events_url":"https://api.github.com/users/chilts/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/867/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-auth-server/statuses/ce095523add71f25696f4a04ac79f11660a28364","head":{"label":"shane-tomlinson:account-lockout","ref":"account-lockout","sha":"ce095523add71f25696f4a04ac79f11660a28364","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"repo":{"id":29736914,"name":"fxa-auth-server","full_name":"shane-tomlinson/fxa-auth-server","owner":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shane-tomlinson/fxa-auth-server","description":"The Firefox Accounts authentication server.","fork":true,"url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server","forks_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/forks","keys_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/teams","hooks_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/hooks","issue_events_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/issues/events{/number}","events_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/events","assignees_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/assignees{/user}","branches_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/branches{/branch}","tags_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/tags","blobs_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/statuses/{sha}","languages_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/languages","stargazers_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/stargazers","contributors_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/contributors","subscribers_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/subscribers","subscription_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/subscription","commits_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/contents/{+path}","compare_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/merges","archive_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/downloads","issues_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/issues{/number}","pulls_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/pulls{/number}","milestones_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/milestones{/number}","notifications_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/labels{/name}","releases_url":"https://api.github.com/repos/shane-tomlinson/fxa-auth-server/releases{/id}","created_at":"2015-01-23T14:48:18Z","updated_at":"2015-02-05T15:49:20Z","pushed_at":"2015-02-12T16:26:06Z","git_url":"git://github.com/shane-tomlinson/fxa-auth-server.git","ssh_url":"git@github.com:shane-tomlinson/fxa-auth-server.git","clone_url":"https://github.com/shane-tomlinson/fxa-auth-server.git","svn_url":"https://github.com/shane-tomlinson/fxa-auth-server","homepage":"https://wiki.mozilla.org/Identity/Firefox_Accounts","size":2825,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"d5ae3b59cc1c7add09a3e70edfbe70b0f0321f74","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":10041891,"name":"fxa-auth-server","full_name":"mozilla/fxa-auth-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/fxa-auth-server","description":"The Firefox Accounts authentication server.","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-auth-server","forks_url":"https://api.github.com/repos/mozilla/fxa-auth-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-auth-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-auth-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-auth-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-auth-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-auth-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-auth-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-auth-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-auth-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-auth-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-auth-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-auth-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-auth-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-auth-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-auth-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-auth-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-auth-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-auth-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-auth-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-auth-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-auth-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/fxa-auth-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-auth-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-auth-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-auth-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-auth-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-auth-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-auth-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-auth-server/releases{/id}","created_at":"2013-05-13T21:42:48Z","updated_at":"2015-02-11T08:44:26Z","pushed_at":"2015-02-06T03:40:27Z","git_url":"git://github.com/mozilla/fxa-auth-server.git","ssh_url":"git@github.com:mozilla/fxa-auth-server.git","clone_url":"https://github.com/mozilla/fxa-auth-server.git","svn_url":"https://github.com/mozilla/fxa-auth-server","homepage":"https://wiki.mozilla.org/Identity/Firefox_Accounts","size":11785,"stargazers_count":162,"watchers_count":162,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":53,"forks":39,"open_issues":53,"watchers":162,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867"},"html":{"href":"https://github.com/mozilla/fxa-auth-server/pull/867"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/867"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/867/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/pulls/867/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-auth-server/statuses/ce095523add71f25696f4a04ac79f11660a28364"}}}}