# Path: util/login.py
# def login(userid):
#     # 1. sha1(salt+ip+userid+now)
#     now=str(datetime.now())
#     userid=str(userid)
#     hash=sha1(salt+userid+now)
#     # 2. 储存hash id,userid,hash
#     db.insert("login",userid=userid,hash=hash,time=now,discard=0)
#     # 3. write cookie ua:sha1
#     web.setcookie('cu', hash, 3600*24*30)
#     return hash
# 
# Path: config/setting.py



import web
import urllib
from util import login as login_mod
from config.setting import blankrender,render

class login:
    def GET(self):
        input = web.input()
        if login_mod.logged():
            if "redirect" in input:
                web.redirect(urllib.unquote_plus(input["redirect"]))

# Path: util/login.py
# def login(userid):
#     # 1. sha1(salt+ip+userid+now)
#     now=str(datetime.now())
#     userid=str(userid)
#     hash=sha1(salt+userid+now)
#     # 2. 储存hash id,userid,hash
#     db.insert("login",userid=userid,hash=hash,time=now,discard=0)
#     # 3. write cookie ua:sha1
#     web.setcookie('cu', hash, 3600*24*30)
#     return hash
# 
# Path: config/setting.py



# Path: controller/page/login.py
import web
import urllib
from util import login as login_mod
from config.setting import blankrender,render


class login:
    def GET(self):
        input = web.input()
        if login_mod.logged():
            if "redirect" in input:
                web.redirect(urllib.unquote_plus(input["redirect"]))

            else: