1 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
3 import Cookie, time, ftpio
5 UserNotLoggedIn="UserNotLoggedIn"
8 def __init__(self, cookies, options):
10 ftpio.connect('wwwiface')
11 if 'ftpsessid' in cookies and cookies['ftpsessid']:
12 self.login=ftpio.login_cookie(cookies['ftpsessid'])
16 if 'action' in options:
17 if options['action'] == 'register':
18 self.checkloginpass(options)
19 elif options['action'] == 'logout':
22 def checkloginpass(self, options):
23 if 'login' not in options or 'pass' not in options:
25 self.cookie=ftpio.login_passwd(options['login'], options['pass'])
27 self.login=options['login']
29 C = Cookie.SimpleCookie()
30 C['ftpsessid']=self.cookie
31 #C['ftpsessid']['expires']=time.strftime(
32 #"%a, %d-%b-%y %H:%M:%S GMT",
33 #time.gmtime(time.time()+86400))
39 C = Cookie.SimpleCookie()
41 C['ftpsessid']['expires']=time.strftime("%a, %d-%b-%y %H:%M:%S GMT",
42 time.gmtime(time.time()-31536000))