0

I'm using asp.net mvc core for my project. In the registration form i got a problem with validation.

1) Password ask for special symbol (like @+*! etc)

2) The validation message is not correct (Passwords must have at least one non alphanumeric character. Passwords must have at least one lowercase ('a'-'z')).

How can i change requiments of special symbol to password and where can i change validation error?

I've found the answer for asp.net mvc 5 with config file, but asp.net core doesn't have any config files for this.

3
  • 3
    Possible duplicate of asp.net core mvc password validators Commented Apr 5, 2018 at 12:45
  • @JoshMein: This is about the ErrorDescriber I think, which is separate from the validation rules themselves. Sounds like he already has the rule he wants, but wants to change the message it has. Commented Apr 5, 2018 at 14:32
  • @Charles He said he wants to change the requirements of special symbols and also change the message. If you dont think the duplicate covers all of his question, you are free to answer here as well. Commented Apr 5, 2018 at 16:04

1 Answer 1

1

First you're going to need to make a custom IdentityErrorDescriber.

Then you'll need to add it like so:

services.AddIdentity<ApplicationUser, IdentityRole>()
    .AddErrorDescriber<CustomIdentityErrorDescriber>();

They're a lot of examples of this for localization that you can find.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.