Beispiel #1
0
    def logout(self, node_token):
        authenticate.clear_user_session()

        node_token.user = dict(name = None, id = 0)
        message = "You are now logged out"
        self.show_login_form(node_token, message)
        # clear bookmarks
        node_token.bookmark = 'CLEAR'

        # auto login cookie
        node_token.auto_login_cookie = 'CLEAR'
Beispiel #2
0
def session(environ):
    global_session.session = environ['beaker.session']
    # if this is a new session set up the defaults
    if global_session.session.get('user_id') == None:
        # auto login
        request = Request(environ)
        global_session.session['IP_address'] = request.remote_addr
        auto_cookie = request.cookies.get('auto')
        if auto_cookie:
            if authenticate.auto_login(auto_cookie):
                return
        # normal session start
        authenticate.clear_user_session()

        log.info('%s creating new http session\n%s' % (request.remote_addr, pprint.pformat(global_session.session)))