Prevent user from changing their password
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
<RadzenStack Gap="1rem" class="rz-p-sm-4">
|
||||
<RadzenFormField Text="Роль" Variant="Variant.Outlined">
|
||||
<ChildContent>
|
||||
<RadzenDropDown Data="@roles" TextProperty="Name" ValueProperty="Id" @bind-Value="@Input.RoleId" Name="Role" style="width: 100%" />
|
||||
<RadzenDropDown Data="@roles" TextProperty="Name" ValueProperty="Id" @bind-Value="@Input.RoleId" Disabled="@Input.RoleDisabled" Name="Role" style="width: 100%" />
|
||||
</ChildContent>
|
||||
</RadzenFormField>
|
||||
<RadzenFormField Text="Новый пароль" Variant="Variant.Outlined">
|
||||
@ -54,6 +54,8 @@
|
||||
@code {
|
||||
sealed class InputModel
|
||||
{
|
||||
public bool RoleDisabled { get; set; }
|
||||
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public string Password { get; set; } = "";
|
||||
@ -67,10 +69,13 @@
|
||||
string errorMessage;
|
||||
|
||||
[Parameter]
|
||||
public string UserId { get; set; }
|
||||
public required string CurrentUserId { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string RoleId { get; set; }
|
||||
public required string UserId { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public required string RoleId { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
InputModel Input { get; set; } = new();
|
||||
@ -79,9 +84,10 @@
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
roles = await RoleManager.Roles.OrderBy(x => x.Priority).ToListAsync();
|
||||
|
||||
Input.RoleDisabled = CurrentUserId == UserId;
|
||||
Input.RoleId = RoleId;
|
||||
|
||||
roles = await RoleManager.Roles.OrderBy(x => x.Priority).ToListAsync();
|
||||
}
|
||||
|
||||
async Task DoEditUser(InputModel input)
|
||||
|
||||
Reference in New Issue
Block a user