Spaces:
Running
Running
zaahpi commited on
Commit ·
802be1d
1
Parent(s): 7e57433
Improve authentication flow for improved user experience
Browse filesUpdate Replica HTML to prompt user for sign-in if not authenticated, and handle authentication errors more gracefully.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 01ad339d-418c-47f5-be76-423bcdc9b50c
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: dd13dc49-9b6b-4bde-a7ac-b7c67625f68c
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/c6a48625-afd1-4b8b-b95e-595805001e6c/01ad339d-418c-47f5-be76-423bcdc9b50c/fCtRmKG
Replit-Helium-Checkpoint-Created: true
- replica/index.html +9 -4
replica/index.html
CHANGED
|
@@ -487,13 +487,18 @@
|
|
| 487 |
try {
|
| 488 |
const isSignedIn = await puter.auth.isSignedIn();
|
| 489 |
if (!isSignedIn) {
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
//
|
| 493 |
-
|
|
|
|
|
|
|
|
|
|
| 494 |
}
|
| 495 |
} catch (e) {
|
| 496 |
console.error("Puter Auth Error:", e);
|
|
|
|
|
|
|
| 497 |
}
|
| 498 |
}
|
| 499 |
|
|
|
|
| 487 |
try {
|
| 488 |
const isSignedIn = await puter.auth.isSignedIn();
|
| 489 |
if (!isSignedIn) {
|
| 490 |
+
addChatMessage('ai', "I need you to sign in with Puter to access AI capabilities.");
|
| 491 |
+
await puter.auth.signIn();
|
| 492 |
+
// Re-check after sign in
|
| 493 |
+
if (!await puter.auth.isSignedIn()) {
|
| 494 |
+
addChatMessage('ai', "Authentication failed. Please try again.");
|
| 495 |
+
return;
|
| 496 |
+
}
|
| 497 |
}
|
| 498 |
} catch (e) {
|
| 499 |
console.error("Puter Auth Error:", e);
|
| 500 |
+
addChatMessage('ai', "Authentication failed. Please try again.");
|
| 501 |
+
return;
|
| 502 |
}
|
| 503 |
}
|
| 504 |
|