Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Identity ignoring RequiredLength #774

Closed
naamor opened this issue Mar 15, 2016 · 5 comments
Closed

Identity ignoring RequiredLength #774

naamor opened this issue Mar 15, 2016 · 5 comments
Assignees
Labels

Comments

@naamor
Copy link

naamor commented Mar 15, 2016

I used ASP.NET 5 MVC 6 (1.0.0-rc1-update1) "Web Application" Template with "Individual User Accounts" and changed default password requirements to:

options.Password.RequireDigit = false; options.Password.RequireLowercase = false; options.Password.RequireUppercase = false; options.Password.RequireNonLetterOrDigit = false; options.Password.RequiredLength = 12;

Everything works fine, except RequiredLength.

  • When RequiredLength is lower than 6, the register form always shows "The Password must be at least 6 characters long.".
  • Is RequiredLength higher than 6, and the input lenght between 6 and the defined number (12), I get "Passwords must be at least 12 characters.", is the input lenght lower than 6 the form shows the error from above.
@HaoK
Copy link
Member

HaoK commented Apr 1, 2016

This is because the validation of the form is not tied to the underlying identity code... The validator length is controlled by the View model, see

https://github.com/aspnet/Templates/blob/dev/src/Rules/StarterWeb/IndividualAuth/Models/AccountViewModels/RegisterViewModel.cs#L17

@HaoK HaoK closed this as completed Apr 1, 2016
@divega
Copy link

divega commented Apr 1, 2016

@HaoK doesn't this mean that there is a bug in the template?

@HaoK
Copy link
Member

HaoK commented Apr 1, 2016

The data validation attributes in templates cannot easily share identity configuration. Since the template hardcodes a required length of 6 by default. It needs to be manually changed to match whatever the new required length is to match identity.

@divega
Copy link

divega commented Apr 1, 2016

What I mean is: should we propose that we remove this attribute from the template?

@HaoK
Copy link
Member

HaoK commented Apr 1, 2016 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants