fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.3k stars 1.59k forks source link

[BUG] NormalizedUserName set with ToUpper() couses problems #333

Closed CanMehmetK closed 2 years ago

CanMehmetK commented 2 years ago

Describe the bug SeedTenantAdminAsync (example) NormalizedUserName set with ToUpper() couses problems admin@root.com -> normalized as ADMiN@ROOT.COM

same happens for RoleName

Expected behavior admin@root.com -> normalized as ADMIN@ROOT.COM

        NormalizedEmail = tenant.AdminEmail.ToUpper(System.Globalization.CultureInfo.InvariantCulture),
        NormalizedUserName = adminUserName.ToUpper(System.Globalization.CultureInfo.InvariantCulture),

...or NormalizedEmail = tenant.AdminEmail.ToUpperInvariant()

also already exist in extension

https://github.com/dotnet/aspnetcore/blob/c85baf8db0c72ae8e68643029d514b2e737c9fae/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs#L83

https://github.com/dotnet/aspnetcore/blob/a450cb69b5e4549f5515cdb057a68771f56cefd7/src/Identity/Extensions.Core/src/UpperInvariantLookupNormalizer.cs#L16

fretje commented 2 years ago

Using ILookupNormalizer seems to be the way to go indeed...

Can you raise a PR?

iammukeshm commented 2 years ago

Changes made in https://github.com/fullstackhero/dotnet-webapi-boilerplate/commit/e04ea0cf827153e1fc6b4dfe3d2751592437f277

Please check with the latest code and confirm.