Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
fcdc7ac
1
Parent(s):
93e229f
wip
Browse files
app.py
CHANGED
|
@@ -101,17 +101,18 @@ def add_solution_cbk(
|
|
| 101 |
# Stable account id
|
| 102 |
user_info = fetch_user_info(token)
|
| 103 |
logger.info("Logged in user info: %s", user_info)
|
| 104 |
-
stable_id = user_info.get("id")
|
| 105 |
logger.info(f"User stable ID: {stable_id}")
|
| 106 |
|
| 107 |
-
if
|
| 108 |
-
|
| 109 |
-
|
|
|
|
| 110 |
|
| 111 |
if not profile.username:
|
| 112 |
return styled_error("Could not retrieve username. Please try signing in again.")
|
| 113 |
# We rely on underscores as separators in submission ID, replace it with "-".
|
| 114 |
-
|
| 115 |
|
| 116 |
try:
|
| 117 |
# Validating the submission file.
|
|
@@ -160,9 +161,7 @@ def gate_submission(profile: gr.OAuthProfile | None):
|
|
| 160 |
"""
|
| 161 |
@brief Toggles the visibility of the login box and submission panel based on the user's login status.
|
| 162 |
"""
|
| 163 |
-
|
| 164 |
-
logged_in = ui is not None
|
| 165 |
-
if not logged_in:
|
| 166 |
return gr.update(visible=True), gr.update(visible=False)
|
| 167 |
return gr.update(visible=False), gr.update(visible=True)
|
| 168 |
|
|
|
|
| 101 |
# Stable account id
|
| 102 |
user_info = fetch_user_info(token)
|
| 103 |
logger.info("Logged in user info: %s", user_info)
|
| 104 |
+
stable_id = user_info.get("id") if user_info else None
|
| 105 |
logger.info(f"User stable ID: {stable_id}")
|
| 106 |
|
| 107 |
+
# TODO: find a way to invalidate login status if token is outdated
|
| 108 |
+
# if not stable_id:
|
| 109 |
+
# return styled_error("Could not retrieve your stable user ID. Please try signing in again.")
|
| 110 |
+
# user_id = stable_id
|
| 111 |
|
| 112 |
if not profile.username:
|
| 113 |
return styled_error("Could not retrieve username. Please try signing in again.")
|
| 114 |
# We rely on underscores as separators in submission ID, replace it with "-".
|
| 115 |
+
user_id = profile.username.replace("_", "-")
|
| 116 |
|
| 117 |
try:
|
| 118 |
# Validating the submission file.
|
|
|
|
| 161 |
"""
|
| 162 |
@brief Toggles the visibility of the login box and submission panel based on the user's login status.
|
| 163 |
"""
|
| 164 |
+
if profile is None:
|
|
|
|
|
|
|
| 165 |
return gr.update(visible=True), gr.update(visible=False)
|
| 166 |
return gr.update(visible=False), gr.update(visible=True)
|
| 167 |
|