Spaces:
Sleeping
Sleeping
Update app.py
Browse files24 unmodified lines25262728293031323334353637383940413132333435363742434445464748495051525354553940414256574458594660616224 unmodified linesif "last_seen_count" not in st.session_state: st.session_state.last_seen_count = len(df)
# -----------------------------------------# تسجيل الدخول# -----------------------------------------# تحميل بيانات المستخدمينusers_file = "users.csv"if os.path.exists(users_file): users_df = pd.read_csv(users_file)else: st.error("⚠️ ملف المستخدمين غير موجود!") st.stop()
# -----------------------------------------# تسجيل الدخولif not st.session_state.is_logged_in: st.title("🔐 Sign In") username = st.text_input("User Name ") password = st.text_input("Password", type="password") if st.button("Sing in "): if username and password: if username.startswith("admin"): st.session_state.user_type = "receiver" st.title("🔐 تسجيل الدخول") username = st.text_input("اسم المستخدم") password = st.text_input("كلمة المرور", type="password") if st.button("تسجيل الدخول"): user_row = users_df[users_df["username"] == username] if not user_row.empty: stored_password = user_row.iloc[0]["password"] role = user_row.iloc[0]["role"] if password == str(stored_password): st.session_state.is_logged_in = True st.session_state.username = username st.session_state.user_type = "sender" if role == "sender" else "receiver" st.rerun() else: st.session_state.user_type = "sender" st.session_state.is_logged_in = True st.session_state.username = username st.rerun() st.error("❌ كلمة المرور غير صحيحة.") else: st.warning("يرجى إدخال اسم المستخدم وكلمة المرور") st.warning("❌ اسم المستخدم غير موجود.")
# -----------------------------------------# مقدم الشكوىelif st.session_state.user_type == "sender": st.title("📨 تقديم شكوى")app.py+26-13