Spaces:
Running
Running
File size: 436 Bytes
9bc1376 addd57d 67e8fdc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import os
import streamlit as st
from typing import Optional
def current_uid() -> Optional[str]:
"""Return the signed-in user's id/email from session, if any."""
return st.session_state.get("uid")
def get_current_uid() -> str:
"""Get current user ID with validation. Raises error if not logged in."""
uid = current_uid()
if not uid:
st.error("Please log in to continue.")
st.stop()
return uid
|