def POST(self): ''' ''' # 获取用户列表 userName = web.input().userName self.userInfoList = UserInfo.selectAll(userName) return Common.render.userInfo.list(self)
def POST(self): ''' ''' self.userName = web.input().userName self.password = web.input().password self.confirmPassword = web.input().confirmPassword # 验证输入项目 if self.checkForm(): if UserInfo.insert(self.userName, self.password) > 0: return web.seeother('/userInfo/list') else: return Common.render.userInfo.modify(self) else: return Common.render.userInfo.modify(self)
def checkForm(self): ''' 输入表单验证 ''' if self.userName == "": return False if self.password == "": return False if self.confirmPassword == "": return False if self.password != self.confirmPassword: return False if UserInfo.select(self.userName) != None: return False return True
def login(self, userName, password): """ 用户登录 returns: true:登录成功 false:登录失败 """ if DBUserInfo.login(userName, password): Logger.info("用户验证成功") userInfo = UserInfo(userName, 0); from webapp.Common import Common Common.session.userInfo = userInfo # 初始化菜单数据 from MenuManagement import MenuManagement Common.session.menu = MenuManagement(userName) return True else: Logger.info("用户验证失败") return False;