{"action":"created","comment":{"url":"https://api.github.com/repos/getsentry/sentry/pulls/comments/66541770","id":66541770,"diff_hunk":"@@ -0,0 +1,65 @@\n+from __future__ import absolute_import\n+\n+from datetime import timedelta\n+\n+from django.conf import settings\n+from django.core.urlresolvers import reverse\n+from django.db import models\n+from django.utils import timezone\n+from django.utils.translation import ugettext_lazy as _\n+\n+from sentry.db.models import FlexibleForeignKey, Model, sane_repr\n+from sentry.utils.http import absolute_uri\n+\n+\n+class Email(Model):\n+    __core__ = True\n+\n+    user = FlexibleForeignKey(settings.AUTH_USER_MODEL,\n+                              unique=False,\n+                              related_name='emails')\n+    email = models.EmailField(_('email address'))\n+    validation_hash = models.CharField(max_length=32)\n+    date_hash_added = models.DateTimeField(default=timezone.now)\n+    is_verified = models.BooleanField(\n+        _('verified'), default=False,\n+        help_text=_('Designates whether this user has confirmed their email.'))\n+\n+    class Meta:\n+        app_label = 'sentry'\n+        db_table = 'sentry_email'\n+        unique_together = (('user', 'email'),)\n+\n+    __repr__ = sane_repr('user_id', 'email')\n+\n+    def set_hash(self):\n+        import hashlib\n+        import random\n+\n+        self.date_hash_added = timezone.now()\n+        self.validation_hash = hashlib.md5(str(random.randint(1, 10000000))).hexdigest()\n+\n+    def hash_is_valid(self):\n+        return self.validation_hash and self.date_hash_added > timezone.now() - timedelta(hours=48)\n+\n+    def send_confirm_email(self):\n+        from sentry import options\n+        from sentry.utils.email import MessageBuilder\n+\n+        if not self.hash_is_valid():\n+            self.set_hash()\n+            self.save()\n+\n+        context = {\n+            'user': self.user,\n+            'url': absolute_uri(reverse(\n+                'sentry-account-confirm-email',\n+                args=[self.user.id, self.validation_hash]\n+            )),\n+        }\n+        msg = MessageBuilder(\n+            subject='%sConfirm Email' % (options.get('mail.subject-prefix'),),\n+            template='sentry/emails/confirm_email.txt',\n+            context=context,","path":"src/sentry/models/email.py","position":63,"original_position":63,"commit_id":"ce9da3edcc43582174dca87a7bff3e0e11188b34","original_commit_id":"ce9da3edcc43582174dca87a7bff3e0e11188b34","user":{"login":"mattrobenolt","id":375744,"avatar_url":"https://avatars.githubusercontent.com/u/375744?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrobenolt","html_url":"https://github.com/mattrobenolt","followers_url":"https://api.github.com/users/mattrobenolt/followers","following_url":"https://api.github.com/users/mattrobenolt/following{/other_user}","gists_url":"https://api.github.com/users/mattrobenolt/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrobenolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrobenolt/subscriptions","organizations_url":"https://api.github.com/users/mattrobenolt/orgs","repos_url":"https://api.github.com/users/mattrobenolt/repos","events_url":"https://api.github.com/users/mattrobenolt/events{/privacy}","received_events_url":"https://api.github.com/users/mattrobenolt/received_events","type":"User","site_admin":false},"body":"/cc @JTCunning do we need to add a `type` here yet?","created_at":"2016-06-09T23:49:41Z","updated_at":"2016-06-09T23:49:41Z","html_url":"https://github.com/getsentry/sentry/pull/3405#discussion_r66541770","pull_request_url":"https://api.github.com/repos/getsentry/sentry/pulls/3405","_links":{"self":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/comments/66541770"},"html":{"href":"https://github.com/getsentry/sentry/pull/3405#discussion_r66541770"},"pull_request":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/3405"}}},"pull_request":{"url":"https://api.github.com/repos/getsentry/sentry/pulls/3405","id":72580563,"html_url":"https://github.com/getsentry/sentry/pull/3405","diff_url":"https://github.com/getsentry/sentry/pull/3405.diff","patch_url":"https://github.com/getsentry/sentry/pull/3405.patch","issue_url":"https://api.github.com/repos/getsentry/sentry/issues/3405","number":3405,"state":"open","locked":false,"title":"Email verification","user":{"login":"macqueen","id":5026776,"avatar_url":"https://avatars.githubusercontent.com/u/5026776?v=3","gravatar_id":"","url":"https://api.github.com/users/macqueen","html_url":"https://github.com/macqueen","followers_url":"https://api.github.com/users/macqueen/followers","following_url":"https://api.github.com/users/macqueen/following{/other_user}","gists_url":"https://api.github.com/users/macqueen/gists{/gist_id}","starred_url":"https://api.github.com/users/macqueen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macqueen/subscriptions","organizations_url":"https://api.github.com/users/macqueen/orgs","repos_url":"https://api.github.com/users/macqueen/repos","events_url":"https://api.github.com/users/macqueen/events{/privacy}","received_events_url":"https://api.github.com/users/macqueen/received_events","type":"User","site_admin":false},"body":"![screenshot 2016-06-03 15 41 02](https://cloud.githubusercontent.com/assets/5026776/15794670/9df2f6d4-29a1-11e6-9b46-8aacb156bef6.png)\r\n\r\n![screenshot 2016-06-03 15 42 58](https://cloud.githubusercontent.com/assets/5026776/15794716/e279bdec-29a1-11e6-9454-3ef278395eee.png)\r\n\r\n![screenshot 2016-06-03 15 43 47](https://cloud.githubusercontent.com/assets/5026776/15794728/05fc6cf6-29a2-11e6-9045-656a59d7b25b.png)\r\n\r\n![screenshot 2016-06-03 15 44 46](https://cloud.githubusercontent.com/assets/5026776/15794745/23281aaa-29a2-11e6-9486-70e61b0915e3.png)\r\n\r\nNot super fancy -- just based it on how we do password reset.\r\n\r\n@ckj let me know if you have suggestions for making pages with very little text look less silly.\r\n\r\n@ehfeng @getsentry/python  ","created_at":"2016-06-03T22:50:00Z","updated_at":"2016-06-09T23:49:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7d74345507ded77b60340394bdffce5f6ae9701","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/getsentry/sentry/pulls/3405/commits","review_comments_url":"https://api.github.com/repos/getsentry/sentry/pulls/3405/comments","review_comment_url":"https://api.github.com/repos/getsentry/sentry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getsentry/sentry/issues/3405/comments","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/ce9da3edcc43582174dca87a7bff3e0e11188b34","head":{"label":"getsentry:email-verification","ref":"email-verification","sha":"ce9da3edcc43582174dca87a7bff3e0e11188b34","user":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"repo":{"id":873328,"name":"sentry","full_name":"getsentry/sentry","owner":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getsentry/sentry","description":"Sentry is cross-platform crash reporting built with love","fork":false,"url":"https://api.github.com/repos/getsentry/sentry","forks_url":"https://api.github.com/repos/getsentry/sentry/forks","keys_url":"https://api.github.com/repos/getsentry/sentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getsentry/sentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getsentry/sentry/teams","hooks_url":"https://api.github.com/repos/getsentry/sentry/hooks","issue_events_url":"https://api.github.com/repos/getsentry/sentry/issues/events{/number}","events_url":"https://api.github.com/repos/getsentry/sentry/events","assignees_url":"https://api.github.com/repos/getsentry/sentry/assignees{/user}","branches_url":"https://api.github.com/repos/getsentry/sentry/branches{/branch}","tags_url":"https://api.github.com/repos/getsentry/sentry/tags","blobs_url":"https://api.github.com/repos/getsentry/sentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getsentry/sentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getsentry/sentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/getsentry/sentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/{sha}","languages_url":"https://api.github.com/repos/getsentry/sentry/languages","stargazers_url":"https://api.github.com/repos/getsentry/sentry/stargazers","contributors_url":"https://api.github.com/repos/getsentry/sentry/contributors","subscribers_url":"https://api.github.com/repos/getsentry/sentry/subscribers","subscription_url":"https://api.github.com/repos/getsentry/sentry/subscription","commits_url":"https://api.github.com/repos/getsentry/sentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/getsentry/sentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/getsentry/sentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/getsentry/sentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/getsentry/sentry/contents/{+path}","compare_url":"https://api.github.com/repos/getsentry/sentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getsentry/sentry/merges","archive_url":"https://api.github.com/repos/getsentry/sentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getsentry/sentry/downloads","issues_url":"https://api.github.com/repos/getsentry/sentry/issues{/number}","pulls_url":"https://api.github.com/repos/getsentry/sentry/pulls{/number}","milestones_url":"https://api.github.com/repos/getsentry/sentry/milestones{/number}","notifications_url":"https://api.github.com/repos/getsentry/sentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getsentry/sentry/labels{/name}","releases_url":"https://api.github.com/repos/getsentry/sentry/releases{/id}","deployments_url":"https://api.github.com/repos/getsentry/sentry/deployments","created_at":"2010-08-30T22:06:41Z","updated_at":"2016-06-09T23:11:43Z","pushed_at":"2016-06-09T23:00:35Z","git_url":"git://github.com/getsentry/sentry.git","ssh_url":"git@github.com:getsentry/sentry.git","clone_url":"https://github.com/getsentry/sentry.git","svn_url":"https://github.com/getsentry/sentry","homepage":"https://getsentry.com","size":99030,"stargazers_count":9370,"watchers_count":9370,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1119,"mirror_url":null,"open_issues_count":332,"forks":1119,"open_issues":332,"watchers":9370,"default_branch":"master"}},"base":{"label":"getsentry:master","ref":"master","sha":"06b9612bf3812f40746176b0c9a2b4b64c63223f","user":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"repo":{"id":873328,"name":"sentry","full_name":"getsentry/sentry","owner":{"login":"getsentry","id":1396951,"avatar_url":"https://avatars.githubusercontent.com/u/1396951?v=3","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getsentry/sentry","description":"Sentry is cross-platform crash reporting built with love","fork":false,"url":"https://api.github.com/repos/getsentry/sentry","forks_url":"https://api.github.com/repos/getsentry/sentry/forks","keys_url":"https://api.github.com/repos/getsentry/sentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getsentry/sentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getsentry/sentry/teams","hooks_url":"https://api.github.com/repos/getsentry/sentry/hooks","issue_events_url":"https://api.github.com/repos/getsentry/sentry/issues/events{/number}","events_url":"https://api.github.com/repos/getsentry/sentry/events","assignees_url":"https://api.github.com/repos/getsentry/sentry/assignees{/user}","branches_url":"https://api.github.com/repos/getsentry/sentry/branches{/branch}","tags_url":"https://api.github.com/repos/getsentry/sentry/tags","blobs_url":"https://api.github.com/repos/getsentry/sentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getsentry/sentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getsentry/sentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/getsentry/sentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/{sha}","languages_url":"https://api.github.com/repos/getsentry/sentry/languages","stargazers_url":"https://api.github.com/repos/getsentry/sentry/stargazers","contributors_url":"https://api.github.com/repos/getsentry/sentry/contributors","subscribers_url":"https://api.github.com/repos/getsentry/sentry/subscribers","subscription_url":"https://api.github.com/repos/getsentry/sentry/subscription","commits_url":"https://api.github.com/repos/getsentry/sentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/getsentry/sentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/getsentry/sentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/getsentry/sentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/getsentry/sentry/contents/{+path}","compare_url":"https://api.github.com/repos/getsentry/sentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getsentry/sentry/merges","archive_url":"https://api.github.com/repos/getsentry/sentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getsentry/sentry/downloads","issues_url":"https://api.github.com/repos/getsentry/sentry/issues{/number}","pulls_url":"https://api.github.com/repos/getsentry/sentry/pulls{/number}","milestones_url":"https://api.github.com/repos/getsentry/sentry/milestones{/number}","notifications_url":"https://api.github.com/repos/getsentry/sentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getsentry/sentry/labels{/name}","releases_url":"https://api.github.com/repos/getsentry/sentry/releases{/id}","deployments_url":"https://api.github.com/repos/getsentry/sentry/deployments","created_at":"2010-08-30T22:06:41Z","updated_at":"2016-06-09T23:11:43Z","pushed_at":"2016-06-09T23:00:35Z","git_url":"git://github.com/getsentry/sentry.git","ssh_url":"git@github.com:getsentry/sentry.git","clone_url":"https://github.com/getsentry/sentry.git","svn_url":"https://github.com/getsentry/sentry","homepage":"https://getsentry.com","size":99030,"stargazers_count":9370,"watchers_count":9370,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1119,"mirror_url":null,"open_issues_count":332,"forks":1119,"open_issues":332,"watchers":9370,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/3405"},"html":{"href":"https://github.com/getsentry/sentry/pull/3405"},"issue":{"href":"https://api.github.com/repos/getsentry/sentry/issues/3405"},"comments":{"href":"https://api.github.com/repos/getsentry/sentry/issues/3405/comments"},"review_comments":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/3405/comments"},"review_comment":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/3405/commits"},"statuses":{"href":"https://api.github.com/repos/getsentry/sentry/statuses/ce9da3edcc43582174dca87a7bff3e0e11188b34"}}}}
{"actor":{"display_login":"mattrobenolt"}}