def post(self): username = self.get_argument("name") users = db.get("users") if users.has_key(username): self.set_secure_cookie("user", username) self.redirect("/spin/") else: self.write("Authentication failed") return
def get(self): username = self.get_current_user() if not self.current_user: self.redirect("/spin/login") return doc = db.get("default") doc_text = doc.pop("text") self.render("templates/form.html", title="Spin", content=doc_text, id=doc.id, rev=doc.rev, username = username )