def post(self, *args, **kwargs): username = self.get_argument("username") password = self.get_argument("password") name = self.get_argument("name") if UserInfo().counts(username=username): result = False else: UserInfo().create(username=username, password=md5(password), name=name) result = True self.set_secure_cookie("user", username) nav = -2 self.render("default/web-register.html", nav=nav, result=result)
def post(self, *args, **kwargs): username = self.get_argument("username") password = self.get_argument("password") if UserInfo().counts(username=username, password=md5(password)): result = True self.set_secure_cookie("user", username) next_url = self.get_argument("next",default="/") self.redirect(next_url) else: result = False nav = -2 self.render("default/login.html", nav=nav, result=result)