No Talk login:

优秀的“缜密逻辑”---talk is cheap,show me the code.

@app.route('/login', methods=['POST', 'GET'])
def login():
    error = None
    if request.method == 'POST':
        if valid_login(request.form['username'],
                       request.form['password']):
            return log_the_user_in(request.form['username'])
        else:
            error = 'Invalid username/password'
    # the code below is executed if the request method
    # was GET or the credentials were invalid
    return render_template('login.html', error=error)
posted @ 2020-03-01 22:15  Linux-top  阅读(168)  评论(0编辑  收藏  举报