{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/webpay/pulls/comments/24200067","id":24200067,"diff_hunk":"@@ -0,0 +1,78 @@\n+from django.http import Http404\n+from django.core.exceptions import ObjectDoesNotExist\n+\n+from rest_framework import response, serializers, viewsets\n+\n+from lib.solitude.api import client\n+from webpay.api.base import BuyerIsLoggedIn\n+from webpay.api.utils import api_error\n+from webpay.auth.utils import set_user_has_pin\n+from webpay.pin.forms import CreatePinForm, ResetPinForm, VerifyPinForm\n+\n+\n+class PinSerializer(serializers.Serializer):\n+    pin = serializers.BooleanField(default=False)\n+    pin_locked_out = serializers.DateTimeField()\n+    pin_is_locked_out = serializers.BooleanField(default=False)\n+    pin_was_locked_out = serializers.BooleanField(default=False)\n+    pin_reset_started = serializers.BooleanField(default=False)\n+\n+\n+class PinViewSet(viewsets.ViewSet):\n+    permission_classes = (BuyerIsLoggedIn,)\n+    serializer_class = PinSerializer\n+\n+    def retrieve(self, request):\n+        res = client.get_buyer(request.session['uuid'])\n+        if res:\n+            res['pin_reset_started'] = request.session.get(\n+                'was_reverified', False)\n+        serial = PinSerializer(res or None)\n+        return response.Response(serial.data)\n+\n+    def create(self, request):\n+        form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA)\n+        if form.is_valid():\n+            res = client.change_pin(form.uuid,\n+                                    form.cleaned_data['pin'],\n+                                    etag=form.buyer_etag,\n+                                    pin_confirmed=True,\n+                                    clear_was_locked=True)\n+\n+            if form.client_response_is_valid(res):\n+                set_user_has_pin(request, True)\n+                return response.Response(status=204)\n+\n+        return api_error(form, request)\n+\n+    def update(self, request):\n+        form = ResetPinForm(uuid=request.session['uuid'], data=request.DATA,\n+                            session=request.session)\n+        if form.is_valid():\n+            res = client.change_pin(form.uuid,\n+                                    form.cleaned_data['pin'],\n+                                    pin_confirmed=True,\n+                                    clear_was_locked=True)\n+            if form.client_response_is_valid(res):","path":"webpay/pin/api.py","position":57,"original_position":56,"commit_id":"418e8ab839bf3d0f97f9f229fe05f65f974937e8","original_commit_id":"7f1c48717656d03115355026e1fc0d8c1b0657e3","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"body":"user_reset is cleared now","created_at":"2015-02-05T21:13:56Z","updated_at":"2015-02-05T21:13:56Z","html_url":"https://github.com/mozilla/webpay/pull/591#discussion_r24200067","pull_request_url":"https://api.github.com/repos/mozilla/webpay/pulls/591","_links":{"self":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/comments/24200067"},"html":{"href":"https://github.com/mozilla/webpay/pull/591#discussion_r24200067"},"pull_request":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/591"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/webpay/pulls/591","id":28679912,"html_url":"https://github.com/mozilla/webpay/pull/591","diff_url":"https://github.com/mozilla/webpay/pull/591.diff","patch_url":"https://github.com/mozilla/webpay/pull/591.patch","issue_url":"https://api.github.com/repos/mozilla/webpay/issues/591","number":591,"state":"open","locked":false,"title":"Ensure fxa re-auth before PIN reset (bug 1127509)","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"body":"@muffinresearch r?\r\n\r\nWell, I guess I fell down the rabbit hole. It felt like I had to delete all the old PIN stuff to get this patch working right. The main goal was to check the FxA ``auth_at`` timestamp to prevent PIN resets without re-auth but that also broke the old stuff. I held off on deleting stuff I didn't *have to* so hopefully it's not too messy. I'll follow up with more deletion patches for the other code.","created_at":"2015-02-04T22:08:28Z","updated_at":"2015-02-05T21:13:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aeaecc1dc776b8b1cf94ace5a9e508aa473a1585","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/webpay/pulls/591/commits","review_comments_url":"https://api.github.com/repos/mozilla/webpay/pulls/591/comments","review_comment_url":"https://api.github.com/repos/mozilla/webpay/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/webpay/issues/591/comments","statuses_url":"https://api.github.com/repos/mozilla/webpay/statuses/418e8ab839bf3d0f97f9f229fe05f65f974937e8","head":{"label":"kumar303:force-pin-reauth","ref":"force-pin-reauth","sha":"418e8ab839bf3d0f97f9f229fe05f65f974937e8","user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"repo":{"id":6095566,"name":"webpay","full_name":"kumar303/webpay","owner":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kumar303/webpay","description":"","fork":true,"url":"https://api.github.com/repos/kumar303/webpay","forks_url":"https://api.github.com/repos/kumar303/webpay/forks","keys_url":"https://api.github.com/repos/kumar303/webpay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kumar303/webpay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kumar303/webpay/teams","hooks_url":"https://api.github.com/repos/kumar303/webpay/hooks","issue_events_url":"https://api.github.com/repos/kumar303/webpay/issues/events{/number}","events_url":"https://api.github.com/repos/kumar303/webpay/events","assignees_url":"https://api.github.com/repos/kumar303/webpay/assignees{/user}","branches_url":"https://api.github.com/repos/kumar303/webpay/branches{/branch}","tags_url":"https://api.github.com/repos/kumar303/webpay/tags","blobs_url":"https://api.github.com/repos/kumar303/webpay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kumar303/webpay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kumar303/webpay/git/refs{/sha}","trees_url":"https://api.github.com/repos/kumar303/webpay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kumar303/webpay/statuses/{sha}","languages_url":"https://api.github.com/repos/kumar303/webpay/languages","stargazers_url":"https://api.github.com/repos/kumar303/webpay/stargazers","contributors_url":"https://api.github.com/repos/kumar303/webpay/contributors","subscribers_url":"https://api.github.com/repos/kumar303/webpay/subscribers","subscription_url":"https://api.github.com/repos/kumar303/webpay/subscription","commits_url":"https://api.github.com/repos/kumar303/webpay/commits{/sha}","git_commits_url":"https://api.github.com/repos/kumar303/webpay/git/commits{/sha}","comments_url":"https://api.github.com/repos/kumar303/webpay/comments{/number}","issue_comment_url":"https://api.github.com/repos/kumar303/webpay/issues/comments/{number}","contents_url":"https://api.github.com/repos/kumar303/webpay/contents/{+path}","compare_url":"https://api.github.com/repos/kumar303/webpay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kumar303/webpay/merges","archive_url":"https://api.github.com/repos/kumar303/webpay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kumar303/webpay/downloads","issues_url":"https://api.github.com/repos/kumar303/webpay/issues{/number}","pulls_url":"https://api.github.com/repos/kumar303/webpay/pulls{/number}","milestones_url":"https://api.github.com/repos/kumar303/webpay/milestones{/number}","notifications_url":"https://api.github.com/repos/kumar303/webpay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kumar303/webpay/labels{/name}","releases_url":"https://api.github.com/repos/kumar303/webpay/releases{/id}","created_at":"2012-10-05T19:37:32Z","updated_at":"2015-02-04T22:08:07Z","pushed_at":"2015-02-05T21:09:30Z","git_url":"git://github.com/kumar303/webpay.git","ssh_url":"git@github.com:kumar303/webpay.git","clone_url":"https://github.com/kumar303/webpay.git","svn_url":"https://github.com/kumar303/webpay","homepage":null,"size":14700,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"90eb185258c6f5e21de9ff7eaa53d6ee5c1fb77e","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":6037696,"name":"webpay","full_name":"mozilla/webpay","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/webpay","description":"Webpay is an implementation of the WebPaymentProvider spec","fork":false,"url":"https://api.github.com/repos/mozilla/webpay","forks_url":"https://api.github.com/repos/mozilla/webpay/forks","keys_url":"https://api.github.com/repos/mozilla/webpay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/webpay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/webpay/teams","hooks_url":"https://api.github.com/repos/mozilla/webpay/hooks","issue_events_url":"https://api.github.com/repos/mozilla/webpay/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/webpay/events","assignees_url":"https://api.github.com/repos/mozilla/webpay/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/webpay/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/webpay/tags","blobs_url":"https://api.github.com/repos/mozilla/webpay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/webpay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/webpay/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/webpay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/webpay/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/webpay/languages","stargazers_url":"https://api.github.com/repos/mozilla/webpay/stargazers","contributors_url":"https://api.github.com/repos/mozilla/webpay/contributors","subscribers_url":"https://api.github.com/repos/mozilla/webpay/subscribers","subscription_url":"https://api.github.com/repos/mozilla/webpay/subscription","commits_url":"https://api.github.com/repos/mozilla/webpay/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/webpay/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/webpay/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/webpay/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/webpay/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/webpay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/webpay/merges","archive_url":"https://api.github.com/repos/mozilla/webpay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/webpay/downloads","issues_url":"https://api.github.com/repos/mozilla/webpay/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/webpay/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/webpay/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/webpay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/webpay/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/webpay/releases{/id}","created_at":"2012-10-01T23:10:24Z","updated_at":"2015-02-05T19:58:12Z","pushed_at":"2015-02-05T19:58:11Z","git_url":"git://github.com/mozilla/webpay.git","ssh_url":"git@github.com:mozilla/webpay.git","clone_url":"https://github.com/mozilla/webpay.git","svn_url":"https://github.com/mozilla/webpay","homepage":"","size":63250,"stargazers_count":34,"watchers_count":34,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":1,"forks":53,"open_issues":1,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/591"},"html":{"href":"https://github.com/mozilla/webpay/pull/591"},"issue":{"href":"https://api.github.com/repos/mozilla/webpay/issues/591"},"comments":{"href":"https://api.github.com/repos/mozilla/webpay/issues/591/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/591/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/webpay/pulls/591/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/webpay/statuses/418e8ab839bf3d0f97f9f229fe05f65f974937e8"}}}}