Esempio n. 1
0
def save_security_local(sec_key, username):
    """
    Correctly saves the user's security key and 
    user name to their browser cookies.  It also adds the new security key
    to the session.
    """
    cookie = cherrypy.response.cookie
    cookie[COOKIE_USERNAME] = username
    cookie[COOKIE_SEC_KEY] = sec_key
    cookie[COOKIE_USERNAME]['max-age'] = 3600
    cookie[COOKIE_SEC_KEY]['max-age'] = 3600

    cherrypy.response.headers['sec-key'] = sec_key

    save_security_to_session(sec_key, username)
    
    REDIS.set(username, sec_key)