def login(): # Login form should be handled by view controller. # This handler will accept post data and confirm if the user is authenticated. username = request.form.get('username') password = request.form.get('password') user = User.find_user(username) if user: auth = user.authenticate(password) if auth: return "Logged in." else: return "Username and password don't match." return "Username and password don't match."