Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,12 +46,13 @@ def auth():
|
|
| 46 |
result = sf.query(query)
|
| 47 |
|
| 48 |
if result['totalSize'] == 0:
|
| 49 |
-
|
|
|
|
| 50 |
|
| 51 |
customer = result['records'][0]
|
| 52 |
reward_points = customer['Reward_Points__c']
|
| 53 |
|
| 54 |
-
# Redirect to rewards page
|
| 55 |
return redirect(url_for('rewards', customer_id=customer['Id'], points=reward_points))
|
| 56 |
except Exception as e:
|
| 57 |
return f"Error during authentication: {e}"
|
|
|
|
| 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}"
|