Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements for Security, Reliability, and Functionality #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 22, 2023

Description

This pull request includes several enhancements to improve the security, reliability, and functionality of the application. The changes are as follows:

UserModel

  • Added password hashing before storing in the database.
  • Implemented checks for duplicate users, valid email addresses, and complexity requirements for usernames and passwords.

LoginController

  • Added error handling for the case when the get_user_by_username function fails.
  • Handled the case when multiple users with the same username exist in the database.
  • Implemented session management to keep the user logged in after successful login.
  • Added logging of unsuccessful login attempts.

PackageController

  • Added error handling for the case when the update_status function fails.
  • Implemented checks to ensure the consignment with the given id exists before updating its status.
  • Validated the given status before updating the consignment status.
  • Added logging of the status update.

ReportController

  • Added error handling for the case when the get_logs and get_consignments functions fail.
  • Implemented checks to ensure the user has the necessary permissions to view the logs and consignments.

Database Schema

  • Updated the users table to hash passwords before storing them.
  • Updated the consignments table to use an ENUM type for the status field.
  • Added a foreign key constraint to the user_id field in the logs table.
  • Updated the timestamp field to reflect the last update time when a row is updated.
  • Added indexes to the tables for performance, depending on the queries that will be run against these tables.

Summary

This pull request enhances the application's security, reliability, and functionality by implementing password hashing, duplicate user checking, email validation, complexity requirements enforcement, error handling, session management, unsuccessful login attempt logging, consignment existence checking, status validation, status update logging, user permission checking, and database schema updates. These changes ensure a more robust and secure application, providing a better user experience.

Fixes #12.


To checkout this PR branch, run the following command in your terminal:

git checkout {pull_request.branch_name}

🎉 Latest improvements to Sweep:

  • 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

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep (fast): Update the app. check the details
0 participants