Spaces:
Runtime error
Runtime error
Delete models/user.py
Browse files- models/user.py +0 -27
models/user.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
from models.salesforce import sf
|
| 2 |
-
|
| 3 |
-
def login_user(email, password):
|
| 4 |
-
query = f"SELECT Name, Password__c FROM Customer_Login__c WHERE Email__c = '{email}'"
|
| 5 |
-
result = sf.query(query)
|
| 6 |
-
if len(result['records']) == 0:
|
| 7 |
-
return False, "Invalid email or password."
|
| 8 |
-
|
| 9 |
-
user = result['records'][0]
|
| 10 |
-
stored_password = user['Password__c']
|
| 11 |
-
if password == stored_password: # Simplified password verification
|
| 12 |
-
return True, user['Name']
|
| 13 |
-
return False, "Invalid email or password."
|
| 14 |
-
|
| 15 |
-
def signup_user(name, email, phone, password):
|
| 16 |
-
query = f"SELECT Id FROM Customer_Login__c WHERE Email__c = '{email}'"
|
| 17 |
-
result = sf.query(query)
|
| 18 |
-
if len(result['records']) > 0:
|
| 19 |
-
return False, "Email already exists."
|
| 20 |
-
|
| 21 |
-
sf.Customer_Login__c.create({
|
| 22 |
-
'Name': name,
|
| 23 |
-
'Email__c': email,
|
| 24 |
-
'Phone_Number__c': phone,
|
| 25 |
-
'Password__c': password # Store securely in production
|
| 26 |
-
})
|
| 27 |
-
return True, "Signup successful!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|