This PR addresses issue #15 and is a part of the parent issue #13. It updates the login() and signup() functions in main.py to handle POST requests, validate user input, and interact with the database.
Summary of Changes
Modified the login() function to handle POST requests. It now retrieves the username and password from the form data, validates these credentials against the database, and logs the user in if they are valid. If the credentials are not valid, it flashes an error message and renders the login template again.
Modified the signup() function to handle POST requests. It now retrieves the username and password from the form data, validates this input to ensure the username is not already taken and the password meets any necessary requirements. If the input is valid, it creates a new User object and adds it to the database, then logs the user in and redirects them to the home page. If the input is not valid, it flashes an error message and renders the signup template again.
Please review these changes and let me know if any further modifications are required.
Fixes #15.
To checkout this PR branch, run the following command in your terminal:
Use Sweep Map to break large issues into smaller sub-issues, perfect for large tasks like "Sweep (map): migrate from React class components to function components"
Getting Sweep to format before committing! Check out Sweep Sandbox Configs to set it up.
We released a demo of our chunker, where you can find the corresponding blog and code.
💡 To get Sweep to edit this pull request, you can:
Leave a comment below to get Sweep to edit the entire PR
Leave a comment in the code will only modify the file
Edit the original issue to get Sweep to recreate the PR from scratch
Description
This PR addresses issue #15 and is a part of the parent issue #13. It updates the login() and signup() functions in main.py to handle POST requests, validate user input, and interact with the database.
Summary of Changes
Please review these changes and let me know if any further modifications are required.
Fixes #15.
To checkout this PR branch, run the following command in your terminal:
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: