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

Distinguish login failure due to incorrect password #45

Open
superhawk610 opened this issue Jan 12, 2019 · 1 comment
Open

Distinguish login failure due to incorrect password #45

superhawk610 opened this issue Jan 12, 2019 · 1 comment

Comments

@superhawk610
Copy link

Currently, incorrect email or password input to the login mutation both throw a UserNotFoundError, with no distinction made between the two. I would like to be able to tell the user whether their login failed due to an incorrect email or incorrect password.

Relevant Code:

mutations.ts

// line 177
if (!user) {
  throw new UserNotFoundError();
}

// line 196
const valid = await bcrypt.compare(password, user.password);
if (!valid) {
  throw new UserNotFoundError();
}

I understand that this may be by design, and if so, feel free to close this. I'll create a fork for my project and open a PR in case this functionality would be useful to others.

@superhawk610
Copy link
Author

If the PR is not accepted, I've published a gitpkg at https://github.com/superhawk610/graphql-authentication. You can use it in your project like so

yarn add https://github.com/superhawk610/graphql-authentication#graphql-authentication-v0.5.5-gitpkg

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