Skip to content

Conversation

PragnyaKhandelwal
Copy link
Contributor

@PragnyaKhandelwal PragnyaKhandelwal commented Jul 31, 2025

Which issue does this PR close?

Closes #71Hide Sidebar and Chat UI on Login Screen

Rationale for this change

To enhance user experience and security, this PR ensures that the sidebar, chat interface, and profile sections are only shown after successful authentication. This aligns with the broader recommendation to extend authentication coverage across the entire app, rather than limiting it to just the Journaling section.

What changes are included in this PR?

  • Implemented session-based login state tracking using st.session_state['is_logged_in'].
  • Wrapped sidebar, chat UI, and other interactive sections in login checks.
  • Introduced st.rerun() post-login to ensure full UI refresh.
  • Modularized login logic into components/login_page.py.
  • Adjusted header layout for visual clarity and consistency.
  • Refactored image usage (e.g., pink.png) into assets/.
  • UI improvements for buttons, spacing, and structure.

Are these changes tested?

✅ Yes — Tested locally using mock/test users to simulate login behavior and verify UI visibility.

Are there any user-facing changes?

Yes:

  • Before login, users will only see the login screen.
  • Post-login, all other UI components load.
  • Visual tweaks for header and button alignment enhance the interface.
  • Positioned the logout button and the theme toggle button together at right top corner as much as possible just by suing streamlit core utility of column and container

Potential Merge Conflict Warning

⚠️ This PR might trigger a merge conflict in users.db because a local test record was deleted and replaced with mock data for development purposes. This doesn't affect core functionality and can be resolved during merge.

Additional Notes

This PR follows the suggested approach of extending authentication to the entire app, as noted in the project contribution guidelines for authentication features (level 3).
More refinements can follow after feedback or upon merging this foundational structure.

@eccentriccoder01
Copy link
Owner

eccentriccoder01 commented Jul 31, 2025

Is this PR in its final version @PragnyaKhandelwal? Did you check the discussion thread I had mentioned? It's a bit unclear to me. There are merge conflicts... Resolve them and provide a deployment link and relevant screenshots. Thanks.

@PragnyaKhandelwal
Copy link
Contributor Author

PragnyaKhandelwal commented Jul 31, 2025

Closes #71
Also partially overlaps with tasks related to login UI design (I’d be happy to collaborate or adjust if needed)

Rationale for this change

As discussed in the discussions for contributors working on Authentication, two approaches were suggested: placing the login UI inside the Journaling section or authenticating the entire app.

I chose to implement the authentication across the entire app to ensure a more seamless and secure user experience.

What changes are included in this PR?

  • ✅ Implemented a dedicated login page that authenticates the user before accessing the main UI.
  • ✅ Fixed the issue where the sidebar and main UI were visible during login.
  • Resolved a merge conflict related to the users.db file. I deleted my test record and used test credentials solely for debugging. Please note that this might cause merge issues on other local versions.
  • Post-login, users are redirected to the main screen.
  • Reorganized the Logout and Theme toggle buttons to the top-right corner using only Streamlit's core layout, without aggressive custom styling.
  • Attempted to add a background to the login page but kept it minimal due to time constraints and to avoid over-styling.
  • Some changes (like the login UI creation) may intersect with other issues. I'm happy to collaborate or refactor to align with the broader team’s goals.

Are these changes tested?

Yes, they have been tested locally and on the deployed [Streamlit app]
Deployment Link: https://pragnyakhandelwal-talkheal-talkheal-o9x3ll.streamlit.app/

Login Page

Screenshot 2025-07-31 221508

(Separate login UI with username/password and signup prompt)

Post-login View

Screenshot 2025-07-31 221542

(Login redirects to full app interface. Sidebar and UI are no longer visible without login.)

Are there any user-facing changes?

Yes:

  • Users will now see a dedicated login screen.
  • Sidebar and other UI components are now hidden until authentication is successful.
  • Minor improvements in button layout enhance usability.

Notes

  • The users.db merge conflict is resolved now
  • I'm open to any feedback or changes required to align with the existing roadmap or team direction.
  • If this aligns with the scope of the authentication work, I kindly request consideration for level 3 labeling as suggested in the discussions.

Thank you for reviewing this PR! 🙏 I appreciate your time and effort in maintaining this project.
Let me know if you'd like the markdown version or need help editing it directly in GitHub.

@PragnyaKhandelwal
Copy link
Contributor Author

Hi @eccentriccoder01 👋

As per the discussion thread on authentication, I’ve now implemented a separate login page to ensure that the entire app is protected by authentication (not just the journaling section).

The sidebar and chatbot UI are now hidden until login
Theme toggle and logout buttons are moved to the top-right corner for a cleaner layout
Everything is done using Streamlit’s native layout tools – no custom HTML/CSS hacks
I’ve also tested the changes and deployed them here for review:

Let me know if there’s anything you'd like me to adjust or improve—happy to collaborate further! 🙌
Thanks again for the opportunity!

@eccentriccoder01
Copy link
Owner

Hey @PragnyaKhandelwal, I checked out your deployment at https://pragnyakhandelwal-talkheal-talkheal-o9x3ll.streamlit.app/. The login feature you set up looks really effective!

I noticed a small but important issue: every time the page refreshes, you have to log in again, even when switching from the Yoga tab to the TalkHeal tab, etc.

Would you prefer to address this in the current pull request or defer it to a future issue? Additionally, I noticed that this pull request has been closed; could you please reopen it for merging? Thank you!

@PragnyaKhandelwal
Copy link
Contributor Author

Hi @eccentriccoder01 ,

Thank you very much for reviewing my PR and for your kind words about the login feature! I appreciate the detailed feedback regarding the login persistence issue.

Given that addressing the session persistence across page refreshes and tab switches will require a deeper refactor and some additional work, I would prefer to defer that enhancement to a future issue, which I will gladly take ownership of.

For now, I believe this current PR delivers valuable improvements that the rest of the contributors can benefit from immediately. It would be great if you could merge this portion and label the PR/work accordingly. This way, development can continue smoothly while I focus on implementing the persistent login solution next.

Thanks again for your time and support—I’m looking forward to working on the session persistence enhancement shortly!

Best regards,
Pragnya

@eccentriccoder01 eccentriccoder01 linked an issue Aug 2, 2025 that may be closed by this pull request
@eccentriccoder01 eccentriccoder01 added bug Something isn't working gssoc25 level 3 labels Aug 2, 2025
@eccentriccoder01
Copy link
Owner

eccentriccoder01 commented Aug 2, 2025

Thank you very much for confirming this, @PragnyaKhandelwal. The authentication and sidebar issues you addressed are indeed excellent solutions.

I will create another issue concerning the refresh-login problem. Please feel free to address it or any other issues, and I will assign them to you accordingly.

I'm bumping this PR up to level 3 because you've put in a ton of effort. Thanks for making TalkHeal better!

@eccentriccoder01 eccentriccoder01 merged commit a0ff079 into eccentriccoder01:main Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gssoc25 level 3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: Hide Sidebar and Chat UI on Login Screen Bug: Sidebar Toggle Not Working After Collapse
2 participants