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

Logging in with an unverified username returns an unexpected error. #523

Closed
marwand opened this issue Oct 21, 2020 · 1 comment
Closed
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@marwand
Copy link

marwand commented Oct 21, 2020

Describe the bug
According to the developer guide, there are two types of errors:
1-Unexpected errors
2-Expected errors

When a user registers using the registerCustomerAccount mutation and immediately tries to login prior to verifying his account, the login mutation returns an unexpected error. As this is a common error, I believe it should be treated as an expected error.

To Reproduce
Steps to reproduce the behavior:

  1. Register a new account
mutation Register($input: RegisterCustomerInput!) {
        registerCustomerAccount(input: $input) {
            ... on Success {
                success
            }
            ...ErrorResult
        }
    }
fragment ErrorResult on ErrorResult {
  errorCode
  message
}
  1. Login with the newly registered account
mutation SignIn(
  $emailAddress: String!
  $password: String!
  $rememberMe: Boolean!
) {
  login(username: $emailAddress, password: $password, rememberMe: $rememberMe) {
    ... on CurrentUser {
      id
    }
    ...ErrorResult
  }
}

fragment ErrorResult on ErrorResult {
  errorCode
  message
}

  1. The returned error is of the following format
{
  "errors": [
    {
      "message": "Please verify this email address before logging in",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "login"
      ],
      "extensions": {
        "code": "NOT_VERIFIED"
      }
    }
  ],
  "data": null
}

Expected behavior
Something on the order of:

{
  "data": {
    "login": {
      "errorCode": "UNVERIFIED_ACCOUNT_ERROR",
      "message": "Please verify this email address before logging in."
    }
  }
}

Environment:

  • @vendure/core version: 0.16.1
@marwand marwand added the type: bug 🐛 Something isn't working label Oct 21, 2020
@michaelbromley
Copy link
Member

Thanks for the report and you are totally correct! This was already noted by someone else in #500 and will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants