comparison roundup/cgi/client.py @ 1018:b0527d9c8e11

call the cookie something else since it changed
author Richard Jones <richard@users.sourceforge.net>
date Tue, 03 Sep 2002 03:23:56 +0000
parents d6c13142e7b9
children 9990a635de03
comparison
equal deleted inserted replaced
1016:d6c13142e7b9 1018:b0527d9c8e11
1 # $Id: client.py,v 1.7 2002-09-03 02:58:11 richard Exp $ 1 # $Id: client.py,v 1.8 2002-09-03 03:23:56 richard Exp $
2 2
3 __doc__ = """ 3 __doc__ = """
4 WWW request handler (also used in the stand-alone server). 4 WWW request handler (also used in the stand-alone server).
5 """ 5 """
6 6
153 153
154 # look up the user session cookie 154 # look up the user session cookie
155 cookie = Cookie.Cookie(self.env.get('HTTP_COOKIE', '')) 155 cookie = Cookie.Cookie(self.env.get('HTTP_COOKIE', ''))
156 user = 'anonymous' 156 user = 'anonymous'
157 157
158 if (cookie.has_key('roundup_user') and 158 # bump the "revision" of the cookie since the format changed
159 cookie['roundup_user'].value != 'deleted'): 159 if (cookie.has_key('roundup_user_2') and
160 cookie['roundup_user_2'].value != 'deleted'):
160 161
161 # get the session key from the cookie 162 # get the session key from the cookie
162 self.session = cookie['roundup_user'].value 163 self.session = cookie['roundup_user_2'].value
163 # get the user from the session 164 # get the user from the session
164 try: 165 try:
165 # update the lifetime datestamp 166 # update the lifetime datestamp
166 sessions.set(self.session, last_use=time.time()) 167 sessions.set(self.session, last_use=time.time())
167 sessions.commit() 168 sessions.commit()
383 expire = Cookie._getdate(86400*365) 384 expire = Cookie._getdate(86400*365)
384 385
385 # generate the cookie path - make sure it has a trailing '/' 386 # generate the cookie path - make sure it has a trailing '/'
386 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'], 387 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
387 '')) 388 ''))
388 self.header({'Set-Cookie': 'roundup_user=%s; expires=%s; Path=%s;'%( 389 self.header({'Set-Cookie': 'roundup_user_2=%s; expires=%s; Path=%s;'%(
389 self.session, expire, path)}) 390 self.session, expire, path)})
390 391
391 def make_user_anonymous(self): 392 def make_user_anonymous(self):
392 ''' Make us anonymous 393 ''' Make us anonymous
393 394
405 # construct the logout cookie 406 # construct the logout cookie
406 now = Cookie._getdate() 407 now = Cookie._getdate()
407 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'], 408 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
408 '')) 409 ''))
409 self.header({'Set-Cookie': 410 self.header({'Set-Cookie':
410 'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, 411 'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now,
411 path)}) 412 path)})
412 self.login() 413 self.login()
413 414
414 def opendb(self, user): 415 def opendb(self, user):
415 ''' Open the database. 416 ''' Open the database.
464 # construct the logout cookie 465 # construct the logout cookie
465 now = Cookie._getdate() 466 now = Cookie._getdate()
466 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'], 467 path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
467 '')) 468 ''))
468 self.header(headers={'Set-Cookie': 469 self.header(headers={'Set-Cookie':
469 'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)}) 470 'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)})
470 471
471 # Let the user know what's going on 472 # Let the user know what's going on
472 self.ok_message.append(_('You are logged out')) 473 self.ok_message.append(_('You are logged out'))
473 474
474 def registerAction(self): 475 def registerAction(self):

Roundup Issue Tracker: http://roundup-tracker.org/