Yaswanth56 commited on
Commit
69b4844
·
verified ·
1 Parent(s): 6a32d77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -22,21 +22,21 @@ except Exception as e:
22
  # Function to handle user authentication and Salesforce login
23
  def authenticate_user(email, password):
24
  if not sf:
25
- return "Salesforce connection failed. Please check credentials and try again.", "", 0
26
 
27
  try:
28
  query = f"SELECT Id, Reward_Points__c FROM Customer_Login__c WHERE Email__c = '{email}' AND Password__c = '{password}'"
29
  result = sf.query(query)
30
 
31
  if result['totalSize'] == 0:
32
- return "Invalid Login Details", "", 0
33
 
34
  customer = result['records'][0]
35
  reward_points = customer['Reward_Points__c']
36
 
37
  return f"Welcome, you have {reward_points} points. Proceed to rewards.", customer['Id'], reward_points
38
  except Exception as e:
39
- return f"Error during authentication: {e}", "", 0
40
 
41
  # Function to handle reward points logic
42
  def handle_rewards(customer_id, bill_amount, apply_rewards):
 
22
  # Function to handle user authentication and Salesforce login
23
  def authenticate_user(email, password):
24
  if not sf:
25
+ return "Salesforce connection failed. Please check credentials and try again.", None, None
26
 
27
  try:
28
  query = f"SELECT Id, Reward_Points__c FROM Customer_Login__c WHERE Email__c = '{email}' AND Password__c = '{password}'"
29
  result = sf.query(query)
30
 
31
  if result['totalSize'] == 0:
32
+ return "Invalid Login Details", None, None
33
 
34
  customer = result['records'][0]
35
  reward_points = customer['Reward_Points__c']
36
 
37
  return f"Welcome, you have {reward_points} points. Proceed to rewards.", customer['Id'], reward_points
38
  except Exception as e:
39
+ return f"Error during authentication: {e}", None, None
40
 
41
  # Function to handle reward points logic
42
  def handle_rewards(customer_id, bill_amount, apply_rewards):