def error_username(username): q = User.all() q.filter("username ="******"That's not a valid username." elif dup: return "That username is taken." else: return ""
def post(self): username = self.request.get('username') password = self.request.get('password') if not username: self.render("login.html",error="Please enter a username") else: q = User.all() q.filter("username ="******"login.html",username=username,error="incorrect username or password") elif valid_pw(username,password,muser.pwhash): userhash = make_user_hash(username) self.response.headers.add_header('Set-Cookie', str('user_id=%s; Path=/'% userhash)) self.redirect("/blog/welcome") else: self.render("login.html",username=username,error="incorrect username or password")