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

Password isn't removed from responses when using a mongoose service for users endpoint #19

Closed
corymsmith opened this Issue Dec 20, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@corymsmith
Copy link
Contributor

corymsmith commented Dec 20, 2015

Since the user object returned is a Mongoose model, delete data.password; doesn't remove the password.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Dec 21, 2015

Ah man, this bullshit again... totally fair point. That's such a shitty gotchya though.

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Dec 21, 2015

Should the adapter just always convert the Mongoose models to objects by default for the next version (and hide the old behaviour behind a flag)?

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Dec 21, 2015

No, because there are times when you want the actual model. I would say it's that about 50% of the time you want the object and the other 50% end up wanting the model.

Again, maybe we can throw an error possibly??

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Dec 21, 2015

How would you throw an error? I guess the hook in this plugin could just check if you're getting a Mongoose Model and convert it.

@corymsmith

This comment has been minimized.

Copy link
Contributor Author

corymsmith commented Dec 21, 2015

Yeah it's just something that can be converted in the hook, can submit a PR for
it.

@corymsmith

This comment has been minimized.

Copy link
Contributor Author

corymsmith commented Dec 21, 2015

Are there other cases with other ORM's that we should handle as well?

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Dec 21, 2015

@corymsmith nothing that I have seen so far but I haven't tried auth yet with the other ORMs. Mongoose seems to be the only one that returns a collection of models instead of the raw documents.

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Dec 21, 2015

I think Sequelize is returning an array of models, too but you can delete properties so it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.