Пример #1
0
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        if authentication(username, password):
            flash('You were successfully logged in')
            return redirect("/")
        else:
            return render_template('login.html',
                                   errmsg="Incorrect username or password.")
    else:
        return render_template('login.html')
Пример #2
0
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        if authentication(username, password):
            session['username'] = username
            return redirect("/")
        else:
            errmsg = "Incorrect username or password."
            return render_template('login.html', errmsg=errmsg)
    else:
        return render_template('login.html')
Пример #3
0
def login():
    logging.debug('login')
    #print request.form
    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        #if authentication(username, password):
        authinfo, ok = authentication(username, password)
        if ok:
            session['sign'] = username
            return redirect("/")
        else:
            #errmsg = "InValid username or password"
            return render_template('login.html', errmsg=authinfo)
    else:
        return render_template('login.html')