summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/views
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-04-22 20:48:19 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-04-22 21:05:47 +0800
commitfd1f5851f960e03a91efd2a93397739ca9473d67 (patch)
tree0aee1dd927ad272f0455d55dee5cdc2c95763e5a /apps/patchwork/views
parent011ee687fda0d3baf66831279565c14e411eab11 (diff)
downloadpatchwork-fd1f5851f960e03a91efd2a93397739ca9473d67.tar.bz2
patchwork-fd1f5851f960e03a91efd2a93397739ca9473d67.tar.xz
Defer Person creation/linkage until registration is confirmed
We currently create Person objects when a registration is submitted, not when it is confirmed. This can lead to stale Person objects for unconfirmed registrations. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/views')
-rw-r--r--apps/patchwork/views/user.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/patchwork/views/user.py b/apps/patchwork/views/user.py
index 4a0e845..a9d6c4c 100644
--- a/apps/patchwork/views/user.py
+++ b/apps/patchwork/views/user.py
@@ -82,6 +82,14 @@ def register_confirm(request, conf):
conf.user.is_active = True
conf.user.save()
conf.deactivate()
+ try:
+ person = Person.objects.get(email__iexact = conf.user.email)
+ except Person.DoesNotExist:
+ person = Person(email = conf.user.email,
+ name = conf.user.get_profile().name())
+ person.user = conf.user
+ person.save()
+
return render_to_response('patchwork/registration-confirm.html')
@login_required