+ Deleting this data will permanently remove your account, and this cannot be recovered.
+
+
+
+
+
+
+
+@section Scripts {
+
+}
diff --git a/Server/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs b/Server/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs
new file mode 100644
index 000000000..20eba0685
--- /dev/null
+++ b/Server/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs
@@ -0,0 +1,107 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+#nullable disable
+
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Extensions.Logging;
+using Remotely.Server.Services;
+using Remotely.Shared.Entities;
+
+namespace Remotely.Server.Areas.Identity.Pages.Account.Manage;
+
+public class DeletePersonalDataModel : PageModel
+{
+ private readonly UserManager _userManager;
+ private readonly SignInManager _signInManager;
+ private readonly IDataService _dataService;
+ private readonly ILogger _logger;
+
+ public DeletePersonalDataModel(
+ UserManager userManager,
+ SignInManager signInManager,
+ IDataService dataService,
+ ILogger logger)
+ {
+ _userManager = userManager;
+ _signInManager = signInManager;
+ _dataService = dataService;
+ _logger = logger;
+ }
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ [BindProperty]
+ public InputModel Input { get; set; }
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public class InputModel
+ {
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ [Required]
+ [DataType(DataType.Password)]
+ public string Password { get; set; }
+ }
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public bool RequirePassword { get; set; }
+
+ public async Task OnGet()
+ {
+ var user = await _userManager.GetUserAsync(User);
+ if (user == null)
+ {
+ return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
+ }
+
+ RequirePassword = await _userManager.HasPasswordAsync(user);
+ return Page();
+ }
+
+ public async Task OnPostAsync()
+ {
+ var user = await _userManager.GetUserAsync(User);
+ if (user == null)
+ {
+ return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
+ }
+
+ RequirePassword = await _userManager.HasPasswordAsync(user);
+ if (RequirePassword)
+ {
+ if (!await _userManager.CheckPasswordAsync(user, Input.Password))
+ {
+ ModelState.AddModelError(string.Empty, "Incorrect password.");
+ return Page();
+ }
+ }
+
+ var userId = user.Id;
+ var deleteResult = await _dataService.DeleteUser(user.OrganizationID, userId);
+ if (!deleteResult.IsSuccess)
+ {
+ throw new InvalidOperationException($"Unexpected error occurred deleting user.");
+ }
+
+ await _signInManager.SignOutAsync();
+
+ _logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId);
+
+ return Redirect("~/");
+ }
+}
diff --git a/Server/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs b/Server/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs
index 4d1010386..1419219b2 100644
--- a/Server/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs
+++ b/Server/Areas/Identity/Pages/Account/Manage/ManageNavPages.cs
@@ -1,49 +1,123 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Rendering;
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+#nullable disable
-namespace Remotely.Server.Areas.Identity.Pages.Account.Manage;
+using System;
+using Microsoft.AspNetCore.Mvc.Rendering;
-public static class ManageNavPages
+namespace Remotely.Server.Areas.Identity.Pages.Account.Manage
{
- public static string Index => "Index";
-
- public static string Email => "Email";
-
- public static string ChangePassword => "ChangePassword";
-
- public static string DownloadPersonalData => "DownloadPersonalData";
-
- public static string DeletePersonalData => "DeletePersonalData";
-
- public static string ExternalLogins => "ExternalLogins";
-
- public static string PersonalData => "PersonalData";
-
- public static string TwoFactorAuthentication => "TwoFactorAuthentication";
-
- public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index);
-
- public static string EmailNavClass(ViewContext viewContext) => PageNavClass(viewContext, Email);
-
- public static string ChangePasswordNavClass(ViewContext viewContext) => PageNavClass(viewContext, ChangePassword);
-
- public static string DownloadPersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, DownloadPersonalData);
-
- public static string DeletePersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, DeletePersonalData);
-
- public static string ExternalLoginsNavClass(ViewContext viewContext) => PageNavClass(viewContext, ExternalLogins);
-
- public static string PersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, PersonalData);
-
- public static string TwoFactorAuthenticationNavClass(ViewContext viewContext) => PageNavClass(viewContext, TwoFactorAuthentication);
-
- private static string PageNavClass(ViewContext viewContext, string page)
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static class ManageNavPages
{
- var activePage = viewContext.ViewData["ActivePage"] as string
- ?? System.IO.Path.GetFileNameWithoutExtension(viewContext.ActionDescriptor.DisplayName);
- return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : "";
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string Index => "Index";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string Email => "Email";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string ChangePassword => "ChangePassword";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string DownloadPersonalData => "DownloadPersonalData";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string DeletePersonalData => "DeletePersonalData";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string ExternalLogins => "ExternalLogins";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string PersonalData => "PersonalData";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string TwoFactorAuthentication => "TwoFactorAuthentication";
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string EmailNavClass(ViewContext viewContext) => PageNavClass(viewContext, Email);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string ChangePasswordNavClass(ViewContext viewContext) => PageNavClass(viewContext, ChangePassword);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string DownloadPersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, DownloadPersonalData);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string DeletePersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, DeletePersonalData);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string ExternalLoginsNavClass(ViewContext viewContext) => PageNavClass(viewContext, ExternalLogins);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string PersonalDataNavClass(ViewContext viewContext) => PageNavClass(viewContext, PersonalData);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string TwoFactorAuthenticationNavClass(ViewContext viewContext) => PageNavClass(viewContext, TwoFactorAuthentication);
+
+ ///
+ /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ public static string PageNavClass(ViewContext viewContext, string page)
+ {
+ var activePage = viewContext.ViewData["ActivePage"] as string
+ ?? System.IO.Path.GetFileNameWithoutExtension(viewContext.ActionDescriptor.DisplayName);
+ return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : null;
+ }
}
}
diff --git a/Server/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml b/Server/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml
new file mode 100644
index 000000000..efa2d880f
--- /dev/null
+++ b/Server/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
diff --git a/Server/Components/ModalContents/EditDeviceGroup.razor b/Server/Components/ModalContents/EditDeviceGroup.razor
index 3d81f6755..811f302ab 100644
--- a/Server/Components/ModalContents/EditDeviceGroup.razor
+++ b/Server/Components/ModalContents/EditDeviceGroup.razor
@@ -1,7 +1,5 @@
@attribute [Authorize]
-@inherits AuthComponentBase
-@inject IDataService DataService
-@inject IToastService ToastService
+@inherits AuthComponentBase
Editing @EditUser?.UserName
@@ -10,55 +8,12 @@
@foreach (var group in DeviceGroups ?? Array.Empty())
{