Marthee commited on
Commit
1510b24
·
verified ·
1 Parent(s): 840cfbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -53,16 +53,16 @@ global colorsused
53
  global pdflink
54
  # For 2.7
55
  global hatched_areas2_7
56
-
57
  # Configure Flask-Session for server-side session storage
58
- app.config["SESSION_TYPE"] = "filesystem"
59
- app.config["SESSION_PERMANENT"] = False
60
- app.config["SESSION_FILE_DIR"] = "./flask_session_files"
61
- app.secret_key = "your_secret_key"
62
 
63
  # Initialize Flask-Session
64
- sess = Session()
65
- sess.init_app(app)
66
 
67
  @app.route("/", methods=["GET", "POST"])
68
  def getInfotoMeasure():
@@ -76,18 +76,25 @@ def password_page():
76
  def check_password():
77
  password = request.form.get("password")
78
  correct_password = "c900"
79
-
80
  if password == correct_password:
81
- session["authenticated"] = True
82
- return jsonify({"authenticated": True}), 200
 
83
  else:
84
- return jsonify({"authenticated": False}), 200
 
 
 
 
 
85
 
86
  @app.route("/mainGUI", methods=["GET", "POST"])
87
  def main_gui():
88
- if "authenticated" not in session or not session["authenticated"]:
 
 
89
  return redirect(url_for("password_page"))
90
- return render_template("proposed-GUI.html")
91
 
92
 
93
 
 
53
  global pdflink
54
  # For 2.7
55
  global hatched_areas2_7
56
+ global passAuthen
57
  # Configure Flask-Session for server-side session storage
58
+ # app.config["SESSION_TYPE"] = "filesystem"
59
+ # app.config["SESSION_PERMANENT"] = False
60
+ # app.config["SESSION_FILE_DIR"] = "./flask_session_files"
61
+ # app.secret_key = "your_secret_key"
62
 
63
  # Initialize Flask-Session
64
+ # sess = Session()
65
+ # sess.init_app(app)
66
 
67
  @app.route("/", methods=["GET", "POST"])
68
  def getInfotoMeasure():
 
76
  def check_password():
77
  password = request.form.get("password")
78
  correct_password = "c900"
 
79
  if password == correct_password:
80
+ global passAuthen
81
+ passAuthen='Authenticated'
82
+ return 'Authenticated'
83
  else:
84
+ return 'NotAuthenticated'
85
+ # if password == correct_password:
86
+ # session["authenticated"] = True
87
+ # return jsonify({"authenticated": True}), 200
88
+ # else:
89
+ # return jsonify({"authenticated": False}), 200
90
 
91
  @app.route("/mainGUI", methods=["GET", "POST"])
92
  def main_gui():
93
+ if passAuthen.startswith('Authenticated'):
94
+ return render_template("proposed-GUI.html")
95
+ else:
96
  return redirect(url_for("password_page"))
97
+
98
 
99
 
100