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

Add role to User.create method in signup function #203

Open
lexliu19 opened this issue Jul 14, 2023 · 2 comments
Open

Add role to User.create method in signup function #203

lexliu19 opened this issue Jul 14, 2023 · 2 comments

Comments

@lexliu19
Copy link

In Authorization: User Roles and Permissions chapter, we need to add role: req.body.role, to signup function, otherwise, the user role will always be default "user" and never updated to req.body.role

exports.signup = catchAsyncError(async (req, res, next) => {
  const newUser = await User.create({
    name: req.body.name,
    email: req.body.email,
    password: req.body.password,
    passwordConfirm: req.body.passwordConfirm,
    role: req.body.role,
  });
....
}
@lexliu19 lexliu19 changed the title Add role to User.create method Add role to User.create method in signup function Jul 14, 2023
@thakareniraj
Copy link

Hello < @LexieLiu19 , I wanted to request your permission to assign the open issue to me. Please let me know if it's okay to proceed with this assignment.

@Medo3-coder
Copy link

thank u @LexieLiu19

piyushjat added a commit to piyushjat/complete-node-bootcamp that referenced this issue Jan 5, 2024
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

No branches or pull requests

3 participants