def POST(self): i = web.input(username=None, password=None) if i.username and i.password: admin = web.ctx.orm.query(Admin).filter_by(username=i.username).first() if admin: if hashlib.md5(i.password).hexdigest() == admin.password: web.ctx.session.isAdmin = 1 raise web.seeother('/') d['error'] = "Wrong username/password!" return render.login(**d)
def POST(self): i = web.input(username=None, password=None) if i.username and i.password: admin = web.ctx.orm.query(Admin).filter_by( username=i.username).first() if admin: if hashlib.md5(i.password).hexdigest() == admin.password: web.ctx.session.isAdmin = 1 raise web.seeother('/') d['error'] = "Wrong username/password!" return render.login(**d)
def GET(self): return render.login(**d)