diff --git a/Moonlight/Core/Models/Forms/ChangeCookiesForm.cs b/Moonlight/Core/Models/Forms/ChangeCookiesForm.cs
new file mode 100644
index 00000000..0090240e
--- /dev/null
+++ b/Moonlight/Core/Models/Forms/ChangeCookiesForm.cs
@@ -0,0 +1,9 @@
+using System.ComponentModel;
+
+namespace Moonlight.Core.Models.Forms;
+
+public class ChangeCookiesForm
+{
+ [Description("This specifies if you would like to personalize your experience with optional cookies.")]
+ public bool UseOptionalCookies { get; set; } = false;
+}
\ No newline at end of file
diff --git a/Moonlight/Core/UI/Views/Account/Security.razor b/Moonlight/Core/UI/Views/Account/Security.razor
index eb69af0a..7c2cb050 100644
--- a/Moonlight/Core/UI/Views/Account/Security.razor
+++ b/Moonlight/Core/UI/Views/Account/Security.razor
@@ -28,7 +28,7 @@
@code
{
private readonly ChangePasswordForm PasswordForm = new();
+
+ private ChangeCookiesForm CookiesForm = new();
- private Task Load(LazyLoader lazyLoader)
+ private async Task Load(LazyLoader lazyLoader)
{
- return Task.CompletedTask;
+ CookiesForm.UseOptionalCookies = await IdentityService.HasFlag("CookieConsent");
}
- private async Task OnValidSubmit()
+ private async Task OnValidSubmitPassword()
{
if (PasswordForm.Password != PasswordForm.RepeatedPassword)
throw new DisplayException("The passwords do not match");
@@ -69,4 +87,11 @@
await ToastService.Success("Successfully changed password");
await IdentityService.Authenticate(true);
}
+
+ private async Task OnValidSubmitCookie()
+ {
+ await IdentityService.SetFlag("CookieConsent", CookiesForm.UseOptionalCookies);
+
+ await InvokeAsync(StateHasChanged);
+ }
}
\ No newline at end of file