Update app.py
Browse files
app.py
CHANGED
|
@@ -259,29 +259,29 @@ def process_ai(input_text):
|
|
| 259 |
|
| 260 |
# Fetch users from the database
|
| 261 |
users = session.query(User).all()
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
if
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
|
| 286 |
name, authentication_status, username = authenticator.login('Login', 'main')
|
| 287 |
|
|
|
|
| 259 |
|
| 260 |
# Fetch users from the database
|
| 261 |
users = session.query(User).all()
|
| 262 |
+
|
| 263 |
+
# Build the credentials dictionary
|
| 264 |
+
credentials = {
|
| 265 |
+
"usernames": {
|
| 266 |
+
user.username: {
|
| 267 |
+
"name": user.username, # Customize if you have a separate name field
|
| 268 |
+
"password": user.password # This should be the hashed password
|
| 269 |
+
}
|
| 270 |
+
for user in users
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
# If no users are present, ensure 'usernames' is an empty dictionary
|
| 275 |
+
if not users:
|
| 276 |
+
credentials = {"usernames": {}}
|
| 277 |
+
|
| 278 |
+
# Initialize Authenticator with keyword arguments
|
| 279 |
+
authenticator = stauth.Authenticate(
|
| 280 |
+
credentials,
|
| 281 |
+
'citibank_demo_business_inc_ai_crypto', # cookie_name
|
| 282 |
+
'abcdef', # key
|
| 283 |
+
cookie_expiry_days=1 # cookie_expiry_days
|
| 284 |
+
)
|
| 285 |
|
| 286 |
name, authentication_status, username = authenticator.login('Login', 'main')
|
| 287 |
|