Skip to content

Commit

Permalink
Merge pull request #238 from ministryofjustice/hotfix/username
Browse files Browse the repository at this point in the history
allow additional characters in the username field to support genuine email addresses
  • Loading branch information
PaulCooperWorkJustice authored Sep 11, 2024
2 parents caf48bb + 4a0b840 commit 86bff19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Infrastructure/Configurations/IdentitySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ public class IdentitySettings : IIdentitySettings
/// </summary>
public int MaxFailedAccessAttempts { get; set; } = 5;

public string AllowedUserNameCharacters { get; set; } = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+'";

}
1 change: 1 addition & 0 deletions src/Infrastructure/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ private static IServiceCollection AddAuthenticationService(this IServiceCollecti

// User settings
options.User.RequireUniqueEmail = true;
options.User.AllowedUserNameCharacters = identitySettings.AllowedUserNameCharacters;
//options.Tokens.EmailConfirmationTokenProvider = "Email";
});

Expand Down
3 changes: 2 additions & 1 deletion src/Server.UI/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"RequireLowerCase": true,
"DefaultLockoutTimeSpan": 30,
"MaxFailedAccessAttempts": 5,
"SecureCookies": true
"SecureCookies": true,
"AllowedUserNameCharacters": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+'"
},
"Notify": {
"ApiKey": "",
Expand Down

0 comments on commit 86bff19

Please sign in to comment.