Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/login', methods=['GET', 'POST'])
- def login():
- return render_template("login.html")
- @app.route('/logincheck', methods=['GET', 'POST'])
- def logincheck():
- error = None
- checkP = g.db.execute('select pword from users where uname = ?', (request.form['username'], ))
- arrayCheck = checkP.fetchall()
- if request.method == 'POST':
- if request.form['password'] != arrayCheck[[0][0]]:
- error = 'Username or password is incorrect'
- return redirect(url_for('login'))
- if len(arrayCheck) == 0:
- error = 'Username or password is incorrect'
- return redirect(url_for('login'))
- else:
- session['logged_in'] = True
- flash('You are logged in')
- return redirect(url_for('userpage'))
- return render_template('login.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement