diff --git a/src/Microsoft.AspNet.Identity/IdentityErrorDescriber.cs b/src/Microsoft.AspNet.Identity/IdentityErrorDescriber.cs index dc56166056..6ce45c5718 100644 --- a/src/Microsoft.AspNet.Identity/IdentityErrorDescriber.cs +++ b/src/Microsoft.AspNet.Identity/IdentityErrorDescriber.cs @@ -233,12 +233,12 @@ namespace Microsoft.AspNet.Identity /// /// The length that is not long enough. /// An indicating a password entered does not contain a non-alphanumeric character. - public virtual IdentityError PasswordRequiresNonLetterAndDigit() + public virtual IdentityError PasswordRequiresNonAlphanumeric() { return new IdentityError { - Code = nameof(PasswordRequiresNonLetterAndDigit), - Description = Resources.PasswordRequiresNonLetterAndDigit + Code = nameof(PasswordRequiresNonAlphanumeric), + Description = Resources.PasswordRequiresNonAlphanumeric }; } diff --git a/src/Microsoft.AspNet.Identity/PasswordOptions.cs b/src/Microsoft.AspNet.Identity/PasswordOptions.cs index ef61fbd252..a46872db5c 100644 --- a/src/Microsoft.AspNet.Identity/PasswordOptions.cs +++ b/src/Microsoft.AspNet.Identity/PasswordOptions.cs @@ -17,13 +17,13 @@ namespace Microsoft.AspNet.Identity public int RequiredLength { get; set; } = 6; /// - /// Gets or sets a flag indicating if passwords must contain a digit or other non-alphabetical character. + /// Gets or sets a flag indicating if passwords must contain a non-alphanumeric character. /// - /// True if passwords must contain a digit or other non-alphabetical character, otherwise false. + /// True if passwords must contain a non-alphanumeric character, otherwise false. /// /// This defaults to true. /// - public bool RequireNonLetterOrDigit { get; set; } = true; + public bool RequireNonAlphanumeric { get; set; } = true; /// /// Gets or sets a flag indicating if passwords must contain a lower case ASCII character. diff --git a/src/Microsoft.AspNet.Identity/PasswordValidator.cs b/src/Microsoft.AspNet.Identity/PasswordValidator.cs index 6cf08804bf..44846fe788 100644 --- a/src/Microsoft.AspNet.Identity/PasswordValidator.cs +++ b/src/Microsoft.AspNet.Identity/PasswordValidator.cs @@ -52,9 +52,9 @@ namespace Microsoft.AspNet.Identity { errors.Add(Describer.PasswordTooShort(options.RequiredLength)); } - if (options.RequireNonLetterOrDigit && password.All(IsLetterOrDigit)) + if (options.RequireNonAlphanumeric && password.All(IsLetterOrDigit)) { - errors.Add(Describer.PasswordRequiresNonLetterAndDigit()); + errors.Add(Describer.PasswordRequiresNonAlphanumeric()); } if (options.RequireDigit && !password.Any(IsDigit)) { diff --git a/src/Microsoft.AspNet.Identity/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Identity/Properties/Resources.Designer.cs index 094c0fe0f8..80c6f7a88b 100644 --- a/src/Microsoft.AspNet.Identity/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNet.Identity/Properties/Resources.Designer.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Identity } /// - /// An unknown failure has occured. + /// An unknown failure has occurred. /// internal static string DefaultError { @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Identity } /// - /// An unknown failure has occured. + /// An unknown failure has occurred. /// internal static string FormatDefaultError() { @@ -299,19 +299,19 @@ namespace Microsoft.AspNet.Identity } /// - /// Passwords must have at least one non letter and non digit character. + /// Passwords must have at least one non alphanumeric character. /// - internal static string PasswordRequiresNonLetterAndDigit + internal static string PasswordRequiresNonAlphanumeric { - get { return GetString("PasswordRequiresNonLetterAndDigit"); } + get { return GetString("PasswordRequiresNonAlphanumeric"); } } /// - /// Passwords must have at least one non letter and non digit character. + /// Passwords must have at least one non alphanumeric character. /// - internal static string FormatPasswordRequiresNonLetterAndDigit() + internal static string FormatPasswordRequiresNonAlphanumeric() { - return GetString("PasswordRequiresNonLetterAndDigit"); + return GetString("PasswordRequiresNonAlphanumeric"); } /// diff --git a/src/Microsoft.AspNet.Identity/Resources.resx b/src/Microsoft.AspNet.Identity/Resources.resx index 455bb1a76c..85e16fc30d 100644 --- a/src/Microsoft.AspNet.Identity/Resources.resx +++ b/src/Microsoft.AspNet.Identity/Resources.resx @@ -189,9 +189,9 @@ Passwords must have at least one lowercase ('a'-'z'). Error when passwords do not have a lowercase letter - - Passwords must have at least one non letter and non digit character. - Error when password does not have enough letter or digit characters + + Passwords must have at least one non alphanumeric character. + Error when password does not have enough non alphanumeric characters Passwords must have at least one uppercase ('A'-'Z'). @@ -281,4 +281,4 @@ User is not in role '{0}'. Error when a user is not in the role - + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Identity.InMemory.Test/FunctionalTest.cs b/test/Microsoft.AspNet.Identity.InMemory.Test/FunctionalTest.cs index 9b221fd64c..0ffcd2f035 100644 --- a/test/Microsoft.AspNet.Identity.InMemory.Test/FunctionalTest.cs +++ b/test/Microsoft.AspNet.Identity.InMemory.Test/FunctionalTest.cs @@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Identity.InMemory var server = CreateServer(services => services.Configure(options => { options.Password.RequireUppercase = false; - options.Password.RequireNonLetterOrDigit = false; + options.Password.RequireNonAlphanumeric = false; options.Password.RequireDigit = false; })); diff --git a/test/Microsoft.AspNet.Identity.Test/IdentityOptionsTest.cs b/test/Microsoft.AspNet.Identity.Test/IdentityOptionsTest.cs index c0734c96a6..e657710ded 100644 --- a/test/Microsoft.AspNet.Identity.Test/IdentityOptionsTest.cs +++ b/test/Microsoft.AspNet.Identity.Test/IdentityOptionsTest.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Identity.Test Assert.True(options.Password.RequireDigit); Assert.True(options.Password.RequireLowercase); - Assert.True(options.Password.RequireNonLetterOrDigit); + Assert.True(options.Password.RequireNonAlphanumeric); Assert.True(options.Password.RequireUppercase); Assert.Equal(6, options.Password.RequiredLength); @@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Identity.Test {"identity:claimsidentity:securitystampclaimtype", securityStampClaimType}, {"identity:user:requireUniqueEmail", "true"}, {"identity:password:RequiredLength", "10"}, - {"identity:password:RequireNonLetterOrDigit", "false"}, + {"identity:password:RequireNonAlphanumeric", "false"}, {"identity:password:RequireUpperCase", "false"}, {"identity:password:RequireDigit", "false"}, {"identity:password:RequireLowerCase", "false"}, @@ -79,7 +79,7 @@ namespace Microsoft.AspNet.Identity.Test Assert.Equal("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@", options.User.AllowedUserNameCharacters); Assert.False(options.Password.RequireDigit); Assert.False(options.Password.RequireLowercase); - Assert.False(options.Password.RequireNonLetterOrDigit); + Assert.False(options.Password.RequireNonAlphanumeric); Assert.False(options.Password.RequireUppercase); Assert.Equal(10, options.Password.RequiredLength); Assert.False(options.Lockout.AllowedForNewUsers); @@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Identity.Test var myOptions = optionsGetter.Value; Assert.True(myOptions.Password.RequireLowercase); Assert.True(myOptions.Password.RequireDigit); - Assert.True(myOptions.Password.RequireNonLetterOrDigit); + Assert.True(myOptions.Password.RequireNonAlphanumeric); Assert.True(myOptions.Password.RequireUppercase); Assert.Equal(-1, myOptions.Password.RequiredLength); } diff --git a/test/Microsoft.AspNet.Identity.Test/PasswordValidatorTest.cs b/test/Microsoft.AspNet.Identity.Test/PasswordValidatorTest.cs index 3ef4288d44..633ebe2b4b 100644 --- a/test/Microsoft.AspNet.Identity.Test/PasswordValidatorTest.cs +++ b/test/Microsoft.AspNet.Identity.Test/PasswordValidatorTest.cs @@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Identity.Test var manager = MockHelpers.TestUserManager(); var valid = new PasswordValidator(); manager.Options.Password.RequireUppercase = false; - manager.Options.Password.RequireNonLetterOrDigit = false; + manager.Options.Password.RequireNonAlphanumeric = false; manager.Options.Password.RequireLowercase = false; manager.Options.Password.RequireDigit = false; IdentityResultAssert.IsFailure(await valid.ValidateAsync(manager, null, input), error); @@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Identity.Test var manager = MockHelpers.TestUserManager(); var valid = new PasswordValidator(); manager.Options.Password.RequireUppercase = false; - manager.Options.Password.RequireNonLetterOrDigit = false; + manager.Options.Password.RequireNonAlphanumeric = false; manager.Options.Password.RequireLowercase = false; manager.Options.Password.RequireDigit = false; IdentityResultAssert.IsSuccess(await valid.ValidateAsync(manager, null, input)); @@ -73,12 +73,12 @@ namespace Microsoft.AspNet.Identity.Test var manager = MockHelpers.TestUserManager(); var valid = new PasswordValidator(); manager.Options.Password.RequireUppercase = false; - manager.Options.Password.RequireNonLetterOrDigit = true; + manager.Options.Password.RequireNonAlphanumeric = true; manager.Options.Password.RequireLowercase = false; manager.Options.Password.RequireDigit = false; manager.Options.Password.RequiredLength = 0; IdentityResultAssert.IsFailure(await valid.ValidateAsync(manager, null, input), - "Passwords must have at least one non letter and non digit character."); + "Passwords must have at least one non alphanumeric character."); } [Theory] @@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Identity.Test var manager = MockHelpers.TestUserManager(); var valid = new PasswordValidator(); manager.Options.Password.RequireUppercase = false; - manager.Options.Password.RequireNonLetterOrDigit = true; + manager.Options.Password.RequireNonAlphanumeric = true; manager.Options.Password.RequireLowercase = false; manager.Options.Password.RequireDigit = false; manager.Options.Password.RequiredLength = 0; @@ -106,7 +106,7 @@ namespace Microsoft.AspNet.Identity.Test [InlineData("aB1@df", Errors.None)] public async Task UberMixedRequiredTests(string input, Errors errorMask) { - const string alphaError = "Passwords must have at least one non letter and non digit character."; + const string alphaError = "Passwords must have at least one non alphanumeric character."; const string upperError = "Passwords must have at least one uppercase ('A'-'Z')."; const string lowerError = "Passwords must have at least one lowercase ('a'-'z')."; const string digitError = "Passwords must have at least one digit ('0'-'9')."; diff --git a/test/Shared/UserManagerTestBase.cs b/test/Shared/UserManagerTestBase.cs index 766f232ac5..1d6fed5ff4 100644 --- a/test/Shared/UserManagerTestBase.cs +++ b/test/Shared/UserManagerTestBase.cs @@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Identity.Test { options.Password.RequireDigit = false; options.Password.RequireLowercase = false; - options.Password.RequireNonLetterOrDigit = false; + options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; options.User.AllowedUserNameCharacters = null; }).AddDefaultTokenProviders();