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

Error response occurred when try to give wrong password policy. #15

Open
geekz-reno opened this issue Sep 11, 2020 · 1 comment
Open

Comments

@geekz-reno
Copy link

Describe the bug
Error occurred when register new account when try to give wrong password policy on identity

To Reproduce
add identityoptions to services.AddIdentity

opt.Password.RequireDigit = true;
opt.Password.RequireLowercase = true;
opt.Password.RequireNonAlphanumeric = false;
opt.Password.RequireUppercase = true;

when i try to give password adindaku, will return this response.

{
  "Succeeded": false,
  "Message": "System.Collections.Generic.List`1[Microsoft.AspNetCore.Identity.IdentityError]",
  "Errors": null,
  "Data": null
}

Expected behavior
will return correct validation message

{
  "Succeeded": false,
  "Message": "One or more validation failures have occurred.",
  "Errors": [
    "Passwords must have at least one digit ('0'-'9').",
    "Passwords must have at least one uppercase ('A'-'Z')."
  ],
  "Data": null
}

Desktop (please complete the following information):

  • OS: MacOS Catalina

Additional context
the problem with throw new ApiException($"{result.Errors}"); it has string constructor.
problem solve when i switch to throw new ValidationException(result.Errors.Select(x => x.Description)); and add another constructor on ValidationException.cs that accept IEnumerable<string> failures.

but i think is that are not acceptable solution because it always return error with header message
"Message": "One or more validation failures have occurred.", either that the exception come from IdentityError or database error.

@MatiasMaldonadoLera
Copy link

Es correcto los errores porque espera una contraseña que tenga mayusculas y que tenga valores numéricos

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

2 participants