fix: enforce 12-char minimum for admin password on Setup page#59
Merged
Conversation
The Setup page advertised and client-validated a 6-character minimum, while AndreGoepel.Marten.Identity already enforces RequiredLength = 12 server-side. The form passed local validation only to be rejected by UserManager.CreateAsync. Surface the real policy: inject IOptions<IdentityOptions>, drive the RadzenLengthValidator from Password.RequiredLength (reflecting any integrator override), and raise the InputModel floor to 12 — mirroring the pattern used by the identity Blazor pages (ResetPassword, etc.). Closes #56
This was referenced Jul 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #56 (F7 — weak password floor for the root administrator).
What
Setup.razor(the initial admin-creation page) advertised and client-validated a 6-character password minimum. MeanwhileAndreGoepel.Marten.Identityalready enforcesoptions.Password.RequiredLength = 12server-side, so a 6–11 char password passed local validation only to be rejected byUserManager.CreateAsync.This change surfaces the real policy on the page:
IOptions<IdentityOptions>and addMinPasswordLength => IdentityOptions.Value.Password.RequiredLength.RadzenLengthValidatorfromMin="@MinPasswordLength"with dynamic text (so an integrator override of the policy is reflected in the UI).InputModel.Passworddata-annotation floor from6to12.Why
The most privileged account in the system (root, non-deletable Administrator) could be attempted with a weak password, and the mismatch between client (6) and server (12) produced a confusing rejection. Aligning the page with the enforced policy fixes both.
Pattern
Mirrors the existing convention in
marten-identity(ResetPassword.razor,SetPassword.razor,ChangePassword.razor): a staticMinimumLength = 12data-annotation floor plus aRadzenLengthValidatorbound toPassword.RequiredLength.Verification
dotnet build -c Release— 0 errors.dotnet test -c Release— 54/54 passing.csharpierformatted; single-file change (line-ending churn on unrelated files was reverted).Reviewer notes
src/AndreGoepel.AppFoundation/Components/Pages/Setup.razor(+6 / -2).