1 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
3 from __future__ import print_function
5 import Cookie, time, ftpio
7 UserNotLoggedIn="UserNotLoggedIn"
10 def __init__(self, cookies, options):
12 ftpio.connect('wwwiface')
13 if 'ftpsessid' in cookies and cookies['ftpsessid']:
14 self.login=ftpio.login_cookie(cookies['ftpsessid'])
18 if 'action' in options:
19 if options['action'] == 'register':
20 self.checkloginpass(options)
21 elif options['action'] == 'logout':
24 def checkloginpass(self, options):
25 if 'login' not in options or 'pass' not in options:
27 self.cookie=ftpio.login_passwd(options['login'], options['pass'])
29 self.login=options['login']
31 C = Cookie.SimpleCookie()
32 C['ftpsessid']=self.cookie
33 #C['ftpsessid']['expires']=time.strftime(
34 #"%a, %d-%b-%y %H:%M:%S GMT",
35 #time.gmtime(time.time()+86400))
41 C = Cookie.SimpleCookie()
43 C['ftpsessid']['expires']=time.strftime("%a, %d-%b-%y %H:%M:%S GMT",
44 time.gmtime(time.time()-31536000))