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

Issue#283 - User authentication (Sign up) successful #380

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

Lanaanvar
Copy link
Contributor

Description

A clear and concise description of what the PR does.

  • This PR does the following:
    • Fixes user authentication error during Sign up

Related Issues

Link any related issues using the format Fixes #issue_number.
This helps to automatically close related issues when the PR is merged.

Changes

List the detailed changes made in this PR.

  • Fixed a bug in Sign Up page due to multiple sending of tokens after signing up

Testing Instructions

Detailed instructions on how to test the changes. Include any setup needed and specific test cases.

  1. Pull this branch.
  2. Run npm install to install dependencies.
  3. Run npm test to execute the test suite.
  4. Verify that valid MONGO_URL exists

Screenshots (if applicable)

image
image
image

Additional Context

Any additional context or information that reviewers should be aware of.

  • After signing up, login in using the same email and password.

Checklist

Make sure to check off all the items before submitting. Mark with [x] if done.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I am working on this issue under GSSOC

Copy link

github-actions bot commented Oct 8, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@Trisha-tech
Copy link
Owner

Description

A clear and concise description of what the PR does.

  • This PR does the following:

    • Fixes user authentication error during Sign up

Related Issues

Link any related issues using the format Fixes #issue_number. This helps to automatically close related issues when the PR is merged.

Changes

List the detailed changes made in this PR.

  • Fixed a bug in Sign Up page due to multiple sending of tokens after signing up

Testing Instructions

Detailed instructions on how to test the changes. Include any setup needed and specific test cases.

  1. Pull this branch.
  2. Run npm install to install dependencies.
  3. Run npm test to execute the test suite.
  4. Verify that valid MONGO_URL exists

Screenshots (if applicable)

image image image

Additional Context

Any additional context or information that reviewers should be aware of.

  • After signing up, login in using the same email and password.

Checklist

Make sure to check off all the items before submitting. Mark with [x] if done.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I am working on this issue under GSSOC

Kindly resolve these conflicts @Lanaanvar
Update readme by NK-Works · Pull Request #363 · Trisha-tech_OnlineBookSales - Google Chrome 10_9_2024 6_32_20 PM

@Lanaanvar
Copy link
Contributor Author

how do i resolve this issue? Not able to click the resolve conflict button

@Lanaanvar
Copy link
Contributor Author

Is this okay?

@Suman373
Copy link
Collaborator

Is this okay?

There is conflict in package lock file. You can remove your own package-lock and keep the updated one from the master branch.

Copy link
Collaborator

@Suman373 Suman373 left a comment

Choose a reason for hiding this comment

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

I am not able to understand where the bug was.

  1. Status code was changed
  2. The response with customer object was changed

@Lanaanvar
Copy link
Contributor Author

I'll explain the issue. When a customer signs up in the registration page, it shows : "An error occurred. Please try again later.". So I checked the backend code and found the problem that was causing this : The original code had multiple calls to sendToken(customer, 201, res). It was also sending multiple responses. So i did the following :

  1. Removed the duplicate call to sendToken(customer, 201, res).
  2. Only a single response is sent with all the required information, including the refreshToken, customer, and optional token.
  3. Changed the status code from 404 to 400 for invalid requests, as it’s more appropriate for bad requests.
  4. Explicitly included only necessary fields from the customer object in the response.

I hope this is understandable.

@Suman373
Copy link
Collaborator

I'll explain the issue. When a customer signs up in the registration page, it shows : "An error occurred. Please try again later.". So I checked the backend code and found the problem that was causing this : The original code had multiple calls to sendToken(customer, 201, res). It was also sending multiple responses. So i did the following :

1. Removed the duplicate call to sendToken(customer, 201, res).

2. Only a single response is sent with all the required information, including the refreshToken, customer, and optional token.

3. Changed the status code from 404 to 400 for invalid requests, as it’s more appropriate for bad requests.

4. Explicitly included only necessary fields from the customer object in the response.

I hope this is understandable.

Yes, this is comprehensive and understandable. Great work !! 👍
@Trisha-tech You may verify and merge

@Trisha-tech Trisha-tech added bug Something isn't working level2 gssoc-ext labels Oct 16, 2024
@Trisha-tech Trisha-tech merged commit d8cd795 into Trisha-tech:master Oct 16, 2024
1 check passed
@Suman373 Suman373 added the hacktoberfest-accepted For valid PRs during hacktoberfest event label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gssoc-ext hacktoberfest-accepted For valid PRs during hacktoberfest event level2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Working on the user authentication in the sign up page
3 participants