init
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
Label="Password"
|
||||
HelperText="Choose a strong password"
|
||||
InputType="InputType.Password"
|
||||
Validation="@(new Func<string, IEnumerable<string>>(PasswordStrength))" Required="true"
|
||||
Validation="@(new Func<string, IEnumerable<string>>(PasswordStrength))" Required="!IsUpdate"
|
||||
RequiredError="Password is required!" />
|
||||
|
||||
<MudTextField T="string"
|
||||
@@ -54,7 +54,16 @@
|
||||
Color="Color.Primary"
|
||||
Disabled="@(!_isFormValid)"
|
||||
Class="ml-auto"
|
||||
OnClick="@(OnRegister)">Register</MudButton>
|
||||
OnClick="@(OnRegister)">
|
||||
@if (IsUpdate)
|
||||
{
|
||||
<MudText Typo="Typo.button">Update</MudText>
|
||||
} else
|
||||
{
|
||||
|
||||
<MudText Typo="Typo.button">Register</MudText>
|
||||
}
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -72,9 +81,16 @@
|
||||
|
||||
private bool _isFormValid { get; set; } = false;
|
||||
|
||||
private static IEnumerable<string> PasswordStrength(string pw)
|
||||
private IEnumerable<string> PasswordStrength(string pw)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(pw))
|
||||
// Do not require the password be entered on an update, we could be changing just the roles or email
|
||||
if (IsUpdate && string.IsNullOrWhiteSpace(Model.Password))
|
||||
{
|
||||
yield return "";
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pw) && !IsUpdate)
|
||||
{
|
||||
yield return "Password is required!";
|
||||
yield break;
|
||||
|
||||
Reference in New Issue
Block a user