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

Feature: check for email address existence before sending an email with password recovery token #16

Open
inkiltie opened this issue Jun 3, 2021 · 1 comment

Comments

@inkiltie
Copy link

inkiltie commented Jun 3, 2021

Currently I'm able to enter any garbage email in Password Recovery page and successfully submit. Needed something like in signup API: await getExistingUser(options.to) in send.js or even in RecoverPassword front-end on Next.js.

@inkiltie
Copy link
Author

inkiltie commented Aug 27, 2021

Adding the following code to api/users/graphql/mutations solves the issue:

import getExistingUserByEmail from "../getExistingUserByEmail";

to recoverPassword function:

const existingUser = await getExistingUserByEmail({
  emailAddress: args.emailAddress,
});

if (!existingUser) {
  throw new Error(`A user with the email address ${args.emailAddress} could not be found.`);
}

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

1 participant