Yaswanth56 commited on
Commit
a80046b
·
verified ·
1 Parent(s): b73ecec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -16,7 +16,6 @@ SF_DOMAIN = os.getenv('SF_DOMAIN')
16
 
17
  # Salesforce connection
18
  try:
19
- print("Attempting Salesforce connection...")
20
  sf = Salesforce(username=SF_USERNAME,
21
  password=SF_PASSWORD,
22
  security_token=SF_SECURITY_TOKEN,
@@ -46,13 +45,12 @@ def auth():
46
  result = sf.query(query)
47
 
48
  if result['totalSize'] == 0:
49
- # Return an error message on the login page if no results are found
50
- return render_template('login.html', error="Invalid username or password")
51
 
52
  customer = result['records'][0]
53
  reward_points = customer['Reward_Points__c']
54
 
55
- # Redirect to rewards page if login is successful
56
  return redirect(url_for('rewards', customer_id=customer['Id'], points=reward_points))
57
  except Exception as e:
58
  return f"Error during authentication: {e}"
@@ -102,7 +100,7 @@ def apply_rewards():
102
 
103
  message = f"You earned 10% of your bill amount ({earned_points} points) as reward points!"
104
 
105
- # Render the summary page with Dollar symbol
106
  return render_template(
107
  'apply_rewards.html',
108
  original_bill=bill_amount,
@@ -116,4 +114,4 @@ def apply_rewards():
116
  return f"Error applying rewards: {e}"
117
 
118
  if __name__ == '__main__':
119
- app.run(debug=True, host="0.0.0.0", port=7860)
 
16
 
17
  # Salesforce connection
18
  try:
 
19
  sf = Salesforce(username=SF_USERNAME,
20
  password=SF_PASSWORD,
21
  security_token=SF_SECURITY_TOKEN,
 
45
  result = sf.query(query)
46
 
47
  if result['totalSize'] == 0:
48
+ return "Invalid Login Details"
 
49
 
50
  customer = result['records'][0]
51
  reward_points = customer['Reward_Points__c']
52
 
53
+ # Redirect to rewards page
54
  return redirect(url_for('rewards', customer_id=customer['Id'], points=reward_points))
55
  except Exception as e:
56
  return f"Error during authentication: {e}"
 
100
 
101
  message = f"You earned 10% of your bill amount ({earned_points} points) as reward points!"
102
 
103
+ # Render the summary page
104
  return render_template(
105
  'apply_rewards.html',
106
  original_bill=bill_amount,
 
114
  return f"Error applying rewards: {e}"
115
 
116
  if __name__ == '__main__':
117
+ app.run(debug=True)