Fix demo data population script authentication issues#1
Open
jardahrazdera wants to merge 3 commits intoCodersLab-CZ:mainfrom
Open
Fix demo data population script authentication issues#1jardahrazdera wants to merge 3 commits intoCodersLab-CZ:mainfrom
jardahrazdera wants to merge 3 commits intoCodersLab-CZ:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix demo data population script authentication issues
What was broken
The demo data script (
demo_data.py) couldn't create habits after login - kept getting 401 Unauthorized errors even though the user was successfully logged in.What I did
populate_demo.pythat properly handles Flask session authenticationapp.py(disabled HTTPS-only cookies for local development)Key changes
SESSION_COOKIE_SECUREfromTruetoFalsefor localhost developmentrequests.Session()to maintain login state (like a browser would)How to test
cd backend python populate_demo.pyThen login to the app with
demo_user / demo123and you'll see sample habits with 30 days of tracking data.Note
I kept the original broken script as
demo_data.pyfor comparison - it's a good example of a common authentication mistake. The working version ispopulate_demo.py.