-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Can't update collections having password field. #370
Comments
Hey @subasshrestha - thanks for pointing this out. The Out of curiosity, can I ask what you’re using that field for? |
I am trying to separate admin users and normal users by two different collections. |
You should use the Payload Make sure to never store user Can you do that? Or am I misunderstanding? |
Yeah, I understood your point. But, I have implemented own auth mechanism for normal user with JWT and password is already hashed with bcryptjs. And, I just want to CRUD normal user from admin panel. So, i will update password field name to some other name and will use hook to hash password using bcryptjs for create/update operation. |
@subasshrestha is there a reason you are not using the built in collection authentication? It has worked great for me out of the box, handling multiple user collections and has saved me a ton of time not having to roll my own auth solution. |
I already have login/signup functionality implemented for normal user. So, if i use collection auth and create a user from admin panel, i can't login on existing route. |
@subasshrestha that is true, you would not be able to use the existing routes that you have created. However, you could use the payload routes that are automatically generated for you when you enable auth on a collection. Enabling auth on a collection, will create routes for you so you can perform authentication easily. Login, Logout, Refresh routes can be found here. Along with those, it also enables forgot-password and reset-password routes, which are pretty handy and all you need to do is provide a transport which can be found here
If you created 2 collections with the following slugs Normal users
Admin users
Maybe I am misunderstanding what you are trying to accomplish. But I am just trying to save you from doing extra work than you need to, where payload already does what you are looking to do with your custom routes! |
Okay, I got it. Thank you all for your support. |
This issue has been automatically locked. |
Bug Report
We can't update field named with password.
Expected Behavior
The password field should be updated.
Current Behavior
Shows error like: doc.setPassword is not a function
Possible Solution
Steps to Reproduce
Detailed Description
The text was updated successfully, but these errors were encountered: