mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-22 08:42:44 +01:00
33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
@using Microsoft.AspNetCore.Identity
|
|
@using Phantom.Server.Services.Audit
|
|
@inherits UserEditDialogBase
|
|
@inject UserManager<IdentityUser> UserManager
|
|
@inject AuditLog AuditLog
|
|
|
|
<Modal Id="@ModalId" TitleText="Delete User">
|
|
<Body>
|
|
You are about to delete the user <strong class="fw-semibold">@EditedUserName</strong>.<br>
|
|
This action cannot be undone.
|
|
</Body>
|
|
<Footer>
|
|
<FormSubmitError Model="SubmitModel" />
|
|
<FormButtonSubmit Model="SubmitModel" Label="Delete User" type="button" class="btn btn-danger" @onclick="Submit" />
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @onclick="OnClosed">Cancel</button>
|
|
</Footer>
|
|
</Modal>
|
|
|
|
@code {
|
|
|
|
protected override async Task DoEdit(IdentityUser user) {
|
|
var result = await UserManager.DeleteAsync(user);
|
|
if (result.Succeeded) {
|
|
await AuditLog.AddUserDeletedEvent(user);
|
|
await OnEditSuccess();
|
|
}
|
|
else {
|
|
OnEditFailure(string.Join("\n", result.Errors.Select(static error => error.Description)));
|
|
}
|
|
}
|
|
|
|
}
|