{"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/47897895","id":47897895,"diff_hunk":"@@ -96,3 +100,8 @@ def includeme(config):\n     config.include('.schemas')\n     config.include('.subscribers')\n     config.include('.views')\n+\n+    secret = config.registry.settings['secret_key']\n+    derived = derive_key(secret, b'h.accounts')","path":"h/accounts/__init__.py","position":15,"original_position":15,"commit_id":"37016f2878ab212926d1d9e066467516d2182d4c","original_commit_id":"37016f2878ab212926d1d9e066467516d2182d4c","user":{"login":"nickstenning","id":3602,"avatar_url":"https://avatars.githubusercontent.com/u/3602?v=3","gravatar_id":"","url":"https://api.github.com/users/nickstenning","html_url":"https://github.com/nickstenning","followers_url":"https://api.github.com/users/nickstenning/followers","following_url":"https://api.github.com/users/nickstenning/following{/other_user}","gists_url":"https://api.github.com/users/nickstenning/gists{/gist_id}","starred_url":"https://api.github.com/users/nickstenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickstenning/subscriptions","organizations_url":"https://api.github.com/users/nickstenning/orgs","repos_url":"https://api.github.com/users/nickstenning/repos","events_url":"https://api.github.com/users/nickstenning/events{/privacy}","received_events_url":"https://api.github.com/users/nickstenning/received_events","type":"User","site_admin":false},"body":"But we have a codebase that we're trying to prepare for Python 3 compatibility. These are bytestrings and must remain bytestrings when interpreted by Python 3, so this is correct.","created_at":"2015-12-17T12:00:21Z","updated_at":"2015-12-17T12:00:21Z","html_url":"https://github.com/hypothesis/h/pull/2803#discussion_r47897895","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/2803","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/47897895"},"html":{"href":"https://github.com/hypothesis/h/pull/2803#discussion_r47897895"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2803"}}},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/2803","id":53859686,"html_url":"https://github.com/hypothesis/h/pull/2803","diff_url":"https://github.com/hypothesis/h/pull/2803.diff","patch_url":"https://github.com/hypothesis/h/pull/2803.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/2803","number":2803,"state":"open","locked":false,"title":"Decouple password reset flow from account activation","user":{"login":"finitud","id":209716,"avatar_url":"https://avatars.githubusercontent.com/u/209716?v=3","gravatar_id":"","url":"https://api.github.com/users/finitud","html_url":"https://github.com/finitud","followers_url":"https://api.github.com/users/finitud/followers","following_url":"https://api.github.com/users/finitud/following{/other_user}","gists_url":"https://api.github.com/users/finitud/gists{/gist_id}","starred_url":"https://api.github.com/users/finitud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finitud/subscriptions","organizations_url":"https://api.github.com/users/finitud/orgs","repos_url":"https://api.github.com/users/finitud/repos","events_url":"https://api.github.com/users/finitud/events{/privacy}","received_events_url":"https://api.github.com/users/finitud/received_events","type":"User","site_admin":false},"body":"The following two migrations are still missing:\r\n* Add the `last_password_update` column to the rows for which it's missing\r\n* Make it non-nullable\r\n\r\n# Notes\r\n\r\nPassword reset was dealt with by re-using the account activation mechanism, and the password reset token was thus an activation token. This had the unpleasant side effect that if a user created an account, and asked for a password reset before activating the account, the password reset token would overwrite the activation token, effectively locking them out of their account.\r\n\r\nThe solution implemented here uses a capability URL, where the information needed for the password reset is encoded in the password reset token itself. In particular, a password reset token contains the username of the requestor, and it then becomes URL-safe encoded, timestamped, and signed with a secret key.\r\n\r\nIn addition, we add a new `last_password_update` column to the user table in the database, which gets set to the current time every time the user's password is set.\r\n\r\nWhen the user attempts to reset their password by using a password reset token, the signature of the provided token is verified against our secret key, and the timestamped is checked. If this verification succeeds, we reset the user's password, and update the `last_password_update` field in the corresponding database entry.\r\n\r\nThe password reset fails if the token is invalid, older than 72h, or the user has reset their password after the token creation.","created_at":"2015-12-16T15:57:23Z","updated_at":"2015-12-17T12:00:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d9da335249dfd5225459e629ff0bb01e4376f79","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/2803/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/2803/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/2803/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/37016f2878ab212926d1d9e066467516d2182d4c","head":{"label":"hypothesis:w/pwd-reset","ref":"w/pwd-reset","sha":"37016f2878ab212926d1d9e066467516d2182d4c","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-12-15T10:08:43Z","pushed_at":"2015-12-17T11:56:18Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":25239,"stargazers_count":542,"watchers_count":542,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":136,"forks":131,"open_issues":136,"watchers":542,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"1ceb5fcefd7fa057bdbcf1f73df57d007289531f","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-12-15T10:08:43Z","pushed_at":"2015-12-17T11:56:18Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":25239,"stargazers_count":542,"watchers_count":542,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":136,"forks":131,"open_issues":136,"watchers":542,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2803"},"html":{"href":"https://github.com/hypothesis/h/pull/2803"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/2803"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/2803/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2803/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2803/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/37016f2878ab212926d1d9e066467516d2182d4c"}}}}