Skip to content

Conversation

@Shrikant-Surwase
Copy link

We have to check the username is present or not then and then we have to create new entry in our database

We need to check first if username is present or not.

const user = { username: request.body.username, name: request.body.name, password: hashedPassword }

//we need to first check if user already present or not if present then we have to throw an error otherwise we have
Copy link
Owner

Choose a reason for hiding this comment

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

We should move these lines above the password hashing step because if the username already exists, there's no benefit in hashing the password if we're not going to save the user details in the database.

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.

2 participants