def register(self): if self.__handler.POST: username = self.__handler.get_argument('username') password = self.__handler.get_argument('password') if not Users.exists(username): Users.append_user(username, password) Session.start(self.__handler, username) return 'True' return 'False' else: return Session.valid(self.__handler)
def login(self): if self.__handler.POST: username = self.__handler.get_argument('username') password = self.__handler.get_argument('password') if Users.exists(username): if Users.get_password(username) == password: Session.start(self.__handler, username) return 'True' return 'False' elif Session.valid(self.__handler): return WebData.Script.load('Home') return False