Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login_form = form.Form(
- form.Textbox("username", size=10, description="Username"),
- form.Password("password", size=10, description="Password"),
- form.Button("Login", html="Login", type="submit"),
- validators = [
- form.Validator("Username and password did not match.",
- lambda i: i.username == 'admin' and i.password == 'smuckers_home_boy'),
- ]
- )
- class login:
- def __init__(self):
- self.form = login_form()
- def GET(self):
- return render.login(self.form)
- def POST(self):
- if not self.form.validates():
- return render.login(self.form)
- web.ctx.session.user = self.form.username.value
- raise web.seeother('/admin')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement