onboarding: give new users a list of uncompleted onboarding steps.

(imported from commit 068a6e2112db98965ec5a1c5fc69a9fe285c0333)
This commit is contained in:
Jessica McKellar
2013-05-08 09:27:27 -04:00
parent b5e22bf6b6
commit 24bb8ad797
2 changed files with 12 additions and 1 deletions

View File

@@ -7,6 +7,12 @@ from zephyr.lib.initial_password import initial_api_key
from zephyr.models import UserProfile, Recipient, Subscription
import base64
import hashlib
import simplejson
onboarding_steps = ["sent_stream_message", "sent_private_message", "made_app_sticky"]
def create_onboarding_steps_blob():
return simplejson.dumps([(step, False) for step in onboarding_steps])
# create_user_profile is based on Django's User.objects.create_user,
# except that we don't save to the database so it can used in
@@ -21,7 +27,8 @@ def create_user_profile(realm, email, password, active, bot, full_name, short_na
user_profile = UserProfile(email=email, is_staff=False, is_active=active,
full_name=full_name, short_name=short_name,
last_login=now, date_joined=now, realm=realm,
pointer=-1, is_bot=bot, bot_owner=bot_owner)
pointer=-1, is_bot=bot, bot_owner=bot_owner,
onboarding_steps=create_onboarding_steps_blob())
if bot or not active:
user_profile.set_unusable_password()