def createTicket(session, data): authKey = {} params = utils.str2Dict(data) try: if not params or not params['password'] or not params['username']: return None except KeyError: return None if checkUser('user', params['username'], params['password']): authKey['CSRFPreventionToken'] = uuid4().hex authKey['username'] = params['username'] ticket = params['username'] + ':' + uuid4().hex authKey['ticket'] = ticket session.ticket = authKey return authKey
def __init__(self, cookie): self.params = utils.str2Dict(cookie)