nagasurendra commited on
Commit
0281340
·
verified ·
1 Parent(s): 577ed27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -122,23 +122,27 @@ def order_history():
122
  except Exception as e:
123
  print(f"Error fetching order history: {str(e)}")
124
  return render_template("order_history.html", orders=[], error=str(e))
 
 
125
  @app.route("/logout")
126
  def logout():
127
- # Clear the session variables related to the user
128
  session.pop('name', None)
129
  session.pop('email', None)
130
  session.pop('rewardPoints', None)
131
  session.pop('coupon', None)
132
-
133
- # You can add headers to prevent caching of the page (optional, but helpful)
134
- headers = {
135
- 'Cache-Control': 'no-cache, no-store, must-revalidate',
136
- 'Pragma': 'no-cache',
137
- 'Expires': '0'
138
- }
139
-
140
- # Redirect to the Salesforce login page
141
- return redirect("https://biryanihub-dev-ed.develop.my.salesforce-sites.com/PublicLogin", code=302, headers=headers)
 
 
142
  @app.route("/signup", methods=["GET", "POST"])
143
  def signup():
144
  if request.method == "POST":
 
122
  except Exception as e:
123
  print(f"Error fetching order history: {str(e)}")
124
  return render_template("order_history.html", orders=[], error=str(e))
125
+ from flask import session, redirect, request, url_for, make_response
126
+
127
  @app.route("/logout")
128
  def logout():
129
+ # Clear session variables
130
  session.pop('name', None)
131
  session.pop('email', None)
132
  session.pop('rewardPoints', None)
133
  session.pop('coupon', None)
134
+
135
+ # Create the redirect response
136
+ response = redirect("https://biryanihub-dev-ed.develop.my.salesforce-sites.com/PublicLogin")
137
+
138
+ # Add headers to prevent caching (optional, but helpful)
139
+ response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
140
+ response.headers['Pragma'] = 'no-cache'
141
+ response.headers['Expires'] = '0'
142
+
143
+ # Return the response with the added headers
144
+ return response
145
+
146
  @app.route("/signup", methods=["GET", "POST"])
147
  def signup():
148
  if request.method == "POST":