Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/validateLogin',methods=['POST'])
- def validateLogin():
- try:
- _username = request.form['inputEmail']
- _password = request.form['inputPassword']
- # connect to mysql
- con = mysql.connect()
- cursor = con.cursor()
- cursor.callproc('sp_validateLogin',(_username,))
- data = cursor.fetchall()
- if len(data) > 0:
- if str(data[0][5]) == _password:
- session['user'] = data[0][1]
- return redirect('/userHome')
- else:
- return render_template('error.html',error = 'Wrong password')
- else:
- return render_template('error.html',error = 'Wrong username.')
- except Exception as e:
- return render_template('error.html',error = str(e))
- finally:
- if cursor:
- cursor.close()
- if con:
- con.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement