Пример #1
0
def index():
    username = request.get_cookie('U', secret=secret())
    password = request.get_cookie('P', secret=secret())
    if check_user(username, password):
        return template('todo')
    else:
        return template('login', error=None)
Пример #2
0
def postlogin():
    username = request.forms.get('username')
    password = request.forms.get('password')
    if check_user(username, password):
        response.set_cookie('U', username, secret=secret())
        response.set_cookie('P', password, secret=secret())
        redirect('/')
    else:
        return template('login', error='Wrong username or password. Please try again.')