andrewlock / PwnedPasswords

An ASP.NET Core Identity validator that checks for PwnedPasswords
MIT License
103 stars 12 forks source link

Add support for localization of the error message #17

Closed richteambs closed 4 years ago

richteambs commented 4 years ago

The current validator enables overriding the password text, but because the override value is specified via the IOptions mechanism, it is a one-time configuration setting. This doesn't work well from a localization perspective because you might want to generate different text dynamically, e.g. depending on the request culture.

The default ASP.NET Core PasswordValidator has a configurable Describer property that enables a consumer to override error messages dynamically. We could use a similar concept in the PwndPasswordValidator to enable dynamic error message generation.

Happy to add a PR for this if you think it's a good addition?

andrewlock commented 4 years ago

Absolutely, sounds great. A simple version of the IdentityDescriber would work well I think. I'd happily accept a PR, thanks 🙂

andrewlock commented 4 years ago

Fixed in #18