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

Sign in connection #10 Tony/Spencer #20

Merged
merged 9 commits into from
Oct 30, 2024
Merged

Sign in connection #10 Tony/Spencer #20

merged 9 commits into from
Oct 30, 2024

Conversation

tony1759
Copy link
Collaborator

@tony1759 tony1759 commented Oct 26, 2024

Describe your changes

Added user signup functionality with MongoDB integration:

  • Created POST /api/users endpoint for user creation
  • Added MongoDB User schema with validation
  • Implemented duplicate email/username checking
  • Connected frontend signup form to backend API
  • Added proper error handling and user feedback
  • Fixed form input field names to match backend expectations

Issue ticket number and link

#10

Does your code meet the acceptance criteria?

  • Yes
    • ✓ Successfully creates new users in MongoDB database
    • ✓ Prevents duplicate email registration with error message
    • ✓ Prevents duplicate username registration with error message
    • ✓ Validates password matching
    • ✓ Properly handles and displays error messages

Testing Done

  1. Created new user successfully:

  2. Tested duplicate prevention:

    • Attempted duplicate email - received error
    • Attempted duplicate username - received error
  3. Tested form validation:

    • Password mismatch detection works
    • Required field validation works

Other comments

  • MongoDB connection and schema validation working as expected
  • Error handling implemented for both frontend and backend
  • User feedback implemented through alerts
  • Form fields properly connected to backend API
Screenshot 2024-10-25 at 10 39 01 PM Screenshot 2024-10-25 at 10 34 31 PM Screenshot 2024-10-25 at 10 45 00 PM Screenshot 2024-10-25 at 10 45 44 PM

Sanderson28801 and others added 2 commits October 25, 2024 11:03
- Added POST /api/users endpoint for user creation
- Implemented duplicate email/username checking
- Connected signup form to backend API
- Added MongoDB user schema and validation
- Added error handling for user creation
@tony1759 tony1759 requested a review from myix765 October 26, 2024 02:40
@myix765
Copy link
Collaborator

myix765 commented Oct 26, 2024

Hi @tony1759 and @Sanderson28801, really nice job on completing the ticket! One change I would suggest is instead of hardcoding the backend URL to fetch from, could you instead set it so that the port is retrieved from a .env file instead? That way if people have different ports set up we don't get an error from accessing the server using the wrong URL. Let me know if you have any questions!

src/pages/SignUp.jsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@myix765 myix765 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking into your branch and testing if I can create a user, I'm getting an "An error occurred while creating the user." I tested using Postman and was able to succesfully create a user, but the user was created in the wrong database.
Postman:
image
MongoDB:
Screenshot 2024-10-26 at 5 23 29 PM

Could you test the code with our database? I made a database for our project that everyone should be invited to, let me know if you don't see the invite!

Another thing is the sign up form doesn't seem to be setting the username field in formData (when submitting the form the username is blank in the alert). This actually isn't a problem with your code, it's a problem in main too, but if you could get that working that would be great (the issue is that the name attribute in the username input does not match the formData field)

- Added separate firstName and lastName fields to signup form
- Updated User schema to properly handle first/last names
- Fixed database connection to use shared database
- Updated environment variables for proper API URL
- Removed unused environment variables
@tony1759
Copy link
Collaborator Author

Screenshot 2024-10-26 at 8 32 17 PM Screenshot 2024-10-26 at 8 32 56 PM Screenshot 2024-10-26 at 8 34 42 PM

@myix765 myix765 merged commit 307661b into main Oct 30, 2024
1 check passed
@myix765 myix765 deleted the SignInConnection branch November 4, 2024 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants