Exemple #1
0
def store_user_info(signup_form):
	''' A controller which calls the individual store methods '''
	
	redis_obj = Redis()

	username = signup_form['username']
	email = signup_form['email']
	first_name = signup_form['first_name']
	last_name = signup_form['last_name']
	password = encrypt_password(signup_form['password'])
	auth_token = signup_form['auth_token']
	summary = signup_form['summary']

	user_id = get_next_userId(redis_obj)

	store_email(redis_obj, user_id, email)
	store_username(redis_obj, user_id, username)
	store_first_name(redis_obj, user_id, first_name)
	store_last_name(redis_obj, user_id, last_name)
	store_password(redis_obj, user_id, password)
	store_image_url(redis_obj, user_id, email)
	store_timestamp(redis_obj, user_id)
	store_summary(redis_obj,user_id,summary)
	store_auth_token(redis_obj, user_id, email, auth_token)
	store_uid_with_username(redis_obj, user_id, username)
	store_uid_with_email(redis_obj, user_id, email)
	store_uid_with_auth_token(redis_obj, user_id, auth_token)
	store_email_with_auth_token(redis_obj, email, auth_token)
	store_global_userIds(redis_obj, user_id)
Exemple #2
0
def update_auth_token(redis_obj, auth_token, user_id, email):	
	''' Get the old auth token and update it accordingly '''
	
	key = "userId:%d:auth.token" % (user_id)
	old_auth_token = redis_obj.get_value(key)
	redis_obj.remove_key("auth.token:%s:userId" % (old_auth_token))
	
	store_auth_token(redis_obj, user_id, email, auth_token)

	key = "auth.token:%s:userId" % (auth_token)
	redis_obj.set_value(key, user_id)

	key = "auth.token:%s:email" % (auth_token)
	redis_obj.set_value(key, email)