Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

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 · Fixed by #20
Closed

Comments

@corymsmith
Copy link
Contributor

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

@ekryski
Copy link
Member

ekryski commented Dec 21, 2015

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

@daffl
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
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
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
Copy link
Contributor Author

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

@corymsmith
Copy link
Contributor Author

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

@ekryski
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
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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants