Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. @app.route('/', methods=['GET','POST'])
  2. def index():
  3. if request.method == 'POST':
  4. db = sqlite3.connect('sql.sql3')
  5. db.row_factory = sqlite3.Row
  6. epass=getHash(request.form['postPass'])
  7. query="select username, password from users where username=? and password=?"
  8. t=(request.form['postUser'], epass)
  9. cursor=db.cursor()
  10. cursor.execute(query,t)
  11. rows = cursor.fetchall()
  12. if len(rows) ==1:
  13. bodyText=request.form['postUser'] + " " + request.form["postPass"]
  14. bodyText=bodyText + "Success!"
  15. session['authenticated']='yes'
  16. else:
  17. bodyText = "incorrect login."
  18. return render_template('/index.html')
  19.  
  20. if request.method == 'GET':
  21. return render_template('/index.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement