Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,33 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
}
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def login(username, password):
|
| 10 |
-
|
| 11 |
-
|
|
|
|
| 12 |
else:
|
| 13 |
-
return "
|
| 14 |
|
|
|
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
gr.Markdown("# Login Page")
|
| 17 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from simple_salesforce import Salesforce
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
+
# Salesforce login credentials (replace with your credentials or use environment variables for security)
|
| 6 |
+
sf = Salesforce(username='sairam13@gmail.com',
|
| 7 |
+
password='Sairam@13',
|
| 8 |
+
security_token=' 70kWpq95LK10gbSzirLeBkLo6')
|
|
|
|
| 9 |
|
| 10 |
+
# Function to store login info in Salesforce
|
| 11 |
+
def store_login_in_salesforce(username, password):
|
| 12 |
+
try:
|
| 13 |
+
# Create a new Login_Record__c in Salesforce with the login details
|
| 14 |
+
sf. login_credential__c.create({
|
| 15 |
+
'Username__c': username,
|
| 16 |
+
'Password__c': password # You might want to store the password securely in Salesforce
|
| 17 |
+
})
|
| 18 |
+
return True
|
| 19 |
+
except Exception as e:
|
| 20 |
+
return False
|
| 21 |
+
|
| 22 |
+
# Function to handle login logic (stores login info in Salesforce without validation)
|
| 23 |
def login(username, password):
|
| 24 |
+
# Store login information in Salesforce
|
| 25 |
+
if store_login_in_salesforce(username, password):
|
| 26 |
+
return "Login info stored in Salesforce! Welcome, " + username + "."
|
| 27 |
else:
|
| 28 |
+
return "There was an issue storing your info in Salesforce."
|
| 29 |
|
| 30 |
+
# Gradio Interface
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
gr.Markdown("# Login Page")
|
| 33 |
|