@inherits LocalizableComponentBase
@* The login itself (the root, /clientapi/user): its password changed, or the whole of it deleted, every persona with
it. Deleting it deletes everything public its personas had, and PrivaPub tells the servers that hold it. *@
@Localizer["Change the password"]
@Localizer["Change the password"]
@Localizer["Delete this login"]
@Localizer["Every persona of this login goes with it, and everything public they had, here and on the servers that hold it. It cannot be undone."]
@Localizer["Delete it for good"]
@code {
[Inject] AuthService AuthService { get; set; }
UserPasswordForm password = new();
RemoveSelfForm removal = new();
bool understood;
bool isSaving;
protected override void OnInitialized() => IsLoading = false;
async Task ChangePassword()
{
isSaving = true;
var result = await AuthService.ChangePassword(password);
isSaving = false;
if (result.IsInvalid)
{
Toast.AddResponseError(result);
return;
}
password = new();
Toast.AddResponseSuccess(Localizer["Password changed."]);
}
async Task Delete()
{
isSaving = true;
var result = await AuthService.DeleteAccount(removal);
isSaving = false;
if (result.IsInvalid)
{
Toast.AddResponseError(result);
return;
}
await CascadingState.SignOut();
Navigation.NavigateTo("login");
}
}