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

The non-scaffolded razor page "Register" does not recognise Password.RequiredLength. #2091

Closed
LosManos opened this Issue Dec 4, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@LosManos

LosManos commented Dec 4, 2018

Describe the bug

Setting password length through

public void ConfigureServices(IServiceCollection services){
  ...
  services.Configure<IdentityOptions>(options =>
  {
    options.Password.RequiredLength = 1;
  });
  ...

does not change the non-scaffolded razor page as it always says "The Password must be at least 6 and at max 100 characters long." if inputed password is < 6 characters.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new ASP.NET Core Web 2.1 application
  2. Select "Web application (Model-View Controller)"
  3. Select "Change authentication"
    3.1. Select "Individual User Account"
  4. Select Ok to have the project scaffolded.
  5. Open file Startup.cs
  6. Add
services.Configure<IdentityOptions>(options =>
{
  options.Password.RequiredLength = 1;
});

to method ConfigureServices.
7. Press F5 (or select your favourite start-debug method).
8. In the web browser that pops up
8.1. Select Register
8.2. Type "a@example.com" as user name (or select your favourite fast-to-type email addresss).
8.3. Type "a" as password (or any password shorter than 6 characters).
8.4. Select Register

Expected behavior

The web page should have been updated with information about successful creation of user.

Actual behaviour

The web page says "The Password must be at least 6 and at max 100 characters long."

Additional context

I have a question at stack overflow https://stackoverflow.com/questions/53620708/how-do-i-set-password-options-in-aspnet-core-2-1 that explains the same issue if this is not clear enough.

This issue might be duplicate of #774.

@HaoK

This comment has been minimized.

Member

HaoK commented Dec 4, 2018

Yeah its a dupe of #774 same issue, the UI has a model validation attribute which controls that error message, while the IdentityOptions is configuring identity itself

@serpent5

This comment has been minimized.

serpent5 commented Dec 4, 2018

Does this mean the suggested solution would be to scaffold out the 4 pages and change the StringLength attribute?

@HaoK

This comment has been minimized.

Member

HaoK commented Dec 4, 2018

Yep exactly

@HaoK HaoK added the duplicate label Dec 4, 2018

@HaoK HaoK closed this Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment