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

[#163901873] Send appropriate message to the user #62

Merged
merged 1 commit into from
Feb 14, 2019

Conversation

Sammuel09
Copy link
Contributor

What does this PR do?

Fixes a bug on the signup controller.

Description of Task to be completed?

  • Sends an appropriate message back to the user if the username or email is already in the database
  • Includes tests for the feature

How should this be manually tested?

  • Use git fetch to clone this branch.
  • Switch to this branch in your machine.
  • Run npm run dev to start the server.
  • Sign up a user at http://localhost:3000/api/v1/auth/signup.
  • Try to sign up the same user with the same credentials.
  • The appropriate message is sent back to the user if the email or username has been taken.

What are the relevant pivotal tracker stories?

Link to Pivotal Tracker

@jesseinit jesseinit temporarily deployed to neon-ah-staging-pr-62 February 13, 2019 17:53 Inactive
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
server/controllers/UserController.js Outdated Show resolved Hide resolved
@@ -299,9 +296,22 @@ class UserController {
const { email } = req.body;
const foundUser = await User.findOne({ where: { email } });

if (!foundUser) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this if(!foundUser) {} statement necessary? If the user doesn't exist yet that means the new user can then sign up with the data not give 404 error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this comment, rafmme. Actually, this check is necessary because I need to make sure this user is in the database record or not. This is because only a user whose record has been previously created should be able to get a new verification email.

@Sammuel09 Sammuel09 merged commit fc01be0 into dev Feb 14, 2019
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.

None yet

4 participants