SHARE
TWEET

Untitled

a guest Dec 7th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from flask import Flask
  2. from flask import Flask, flash, redirect, render_template, request, session, abort
  3. import os
  4.  
  5. app = Flask(__name__)
  6.  
  7. @app.route('/')
  8. def home():
  9. if not session.get('logged_in'):
  10. return render_template('login.html')
  11. else:
  12. return "Hello Boss!"
  13.  
  14. @app.route('/login', methods=['POST'])
  15. def do_admin_login():
  16. if request.form['password'] == 'password' and request.form['username'] == 'admin':
  17. session['logged_in'] = True
  18. else:
  19. flash('wrong password!')
  20. return home()
  21.  
  22. if __name__ == "__main__":
  23. app.secret_key = os.urandom(12)
  24. app.run(debug=True,host='0.0.0.0', port=4000)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top