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

Duplicate Email should be rejected by Default #281

Closed
jaeko44 opened this Issue Aug 29, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@jaeko44
Copy link

jaeko44 commented Aug 29, 2016

We need a rejectExistingEmail() hook function for this module.

@jaeko44 jaeko44 closed this Aug 29, 2016

@bertho-zero

This comment has been minimized.

Copy link
Contributor

bertho-zero commented Aug 29, 2016

I created a validateHook with an unique rule for this, you can see its use here.

Hoping I helped

@jaeko44

This comment has been minimized.

Copy link
Author

jaeko44 commented Aug 31, 2016

nice, originally I was using the default suggested database in the 'quick start' app - (NEDB) which didn't support validation schemas.

I wrote my own validateHook (way worse than yours though, it just searched for all users by the email and returned a promise..) when I threw an error it wasn't registering that an error was thrown (I realized later this was because it was inside a promise - the service.find promise)

I ended up then switching to MongoDB which uses mongoose for Schemas - this worked nicely and rejected duplicate emails. However the error it returned wasn't sufficient for users. Have any idea how I can work around that without having to do string compares and write my own error that way?

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.