From 9e2edeeceb1bab774fd13f4d7172b8a2cfe71555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 29 Jul 2015 12:51:23 +0300 Subject: [PATCH] Only associate demo check if it doesn't have an owner already. --- hc/accounts/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 8c0a74f3..2bcf62eb 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -24,8 +24,12 @@ def _make_user(email): def _associate_demo_check(request, user): if "welcome_code" in request.session: check = Check.objects.get(code=request.session["welcome_code"]) - check.user = user - check.save() + + # Only associate demo check if it doesn't have an owner already. + if check.user is None: + check.user = user + check.save() + del request.session["welcome_code"] def _send_login_link(user):