Example #1
0
def set_login_cookie(_user, uid, pw, rem):
    if _user:  # if user has existing login (in python memory)
        if uid in demoIDs or False:  # TODO: replace this false with password check
            login_token = uid + ''.join(
                random.choice(string.ascii_letters + string.digits) for _ in range(5))
            user_obj = getDemoProfile(uid)
            try:
                USERS.addUser(user_obj, login_token)
            except ValueError as e:
                print e.message

            response.set_cookie("cosmosium_login", login_token, max_age=60 * 60 * 5)
            # redirect('/play')
    elif False:  # if user is in database
        # TODO: load user into USERS (python memory)
        pass
    else:
        return user_login('user not found')
Example #2
0
 def addDemoUsers(self):
     for user in demoIDs:
         self.addUser(getDemoProfile(user),user+'temp_token')