locked
Password must contain atleast 1 lower case letter, 1 uppercase letter,1 number and 1 non-alpha-numeric character (cannot include the following in the password: \, ", <, > ) RRS feed

  • Question

  • User221424154 posted
    Password must contain atleast 1 lower case letter, 1 uppercase letter,1 number and 1 non-alpha-numeric character (cannot include the following in the password: \, ", <, > ) and min 8 character and max 50 character
    Friday, April 10, 2020 9:29 AM

Answers

  • User-18289217 posted

    i want to set validation for password. and that password should contain minimum 8 character and atleast 1 lower case character, 1 upper case character, one number and one special character.

    To make the identity aware of the rule you do that when configuring your app (ConfigureServices method)

    services.AddIdentity<ApplicationUser, IdentityRole>(options =>
                {
                    options.Password.RequiredLength = 8;
                    options.Password.RequireDigit = true;
                    options.Password.RequireLowercase = true;
                    options.Password.RequireUppercase = true;
                    options.Password.RequireNonAlphanumeric = true;
                });

    HTH

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 11, 2020 8:49 AM

All replies

  • User-18289217 posted

    What is this? Do you struggle to set the password rule?

    Friday, April 10, 2020 11:00 AM
  • User221424154 posted

    yes

    Friday, April 10, 2020 12:34 PM
  • User475983607 posted

    Your question is far too vague to answer.  Are you a developer?  Are you building a web application?  If so, what technology are you using?  MVC?  Web Forms?  ASP.NET Core?

    Friday, April 10, 2020 12:38 PM
  • User221424154 posted

    MVC

    Friday, April 10, 2020 1:07 PM
  • User475983607 posted

    MVC

    Now that we know you are building an MVC application, explain the problem you are trying to solve using a several sentences.  One word responses are not acceptable and rude.   

    Share code that is causing this issue.  Explain the expected results and the actual results.

    Friday, April 10, 2020 1:35 PM
  • User221424154 posted

    i want to set validation for password. and that password should contain minimum 8 character and atleast 1 lower case character, 1 upper case character, one number and one special character.

    Friday, April 10, 2020 2:53 PM
  • User475983607 posted

    i want to set validation for password. and that password should contain minimum 8 character and atleast 1 lower case character, 1 upper case character, one number and one special character.

    Generally, this type of logic is handled in a security API.  Please share your security API or relevant code. 

    Keep in mind, MVC comes out-of-the-box with this capability using the "Individual Account" option when creating a project.

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/security/create-an-aspnet-mvc-5-web-app-with-email-confirmation-and-password-reset

    Friday, April 10, 2020 3:04 PM
  • User-18289217 posted

    i want to set validation for password. and that password should contain minimum 8 character and atleast 1 lower case character, 1 upper case character, one number and one special character.

    To make the identity aware of the rule you do that when configuring your app (ConfigureServices method)

    services.AddIdentity<ApplicationUser, IdentityRole>(options =>
                {
                    options.Password.RequiredLength = 8;
                    options.Password.RequireDigit = true;
                    options.Password.RequireLowercase = true;
                    options.Password.RequireUppercase = true;
                    options.Password.RequireNonAlphanumeric = true;
                });

    HTH

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 11, 2020 8:49 AM