@page "/account" @using Microsoft.AspNetCore.Components.Authorization @inject NavigationManager Navigation @rendermode InteractiveServer @attribute [Authorize]

My Account

Customer Profile // Active Session

Welcome back, @(context.User.FindFirst("given_name")?.Value ?? context.User.Identity?.Name ?? "Reader")!

@context.User.FindFirst("email")?.Value

Order History
@if (orderHistory != null) { @foreach (var order in orderHistory) {
@order.OrderId
@order.OrderDate.ToString("MMM dd, yyyy")
@order.Status
@order.ProductTitle
Shipping to: @order.ShippingAddressName
Total Paid R @order.Total.ToString("N2")
} } else {
Loading order history...
}
Saved Addresses
@if (!showAddForm && editingAddress == null) { }
@if (showAddForm) {
New Address
} @if (editingAddress != null) {
Edit Address
} @foreach (var addr in savedAddresses) {
@addr.Name

@addr.Street, @addr.City, @addr.PostalCode

@if (addr.IsBilling) { [Billing] } @if (addr.IsShipping) { [Shipping] }
}
Profile Settings
Centralized Identity Management

For your protection, password modifications, recovery settings, authentication methods, and core credentials are managed through our secure Identity Node.

Access Security Center
@code { private bool showAddForm = false; private AddressItem? editingAddress = null; private string newAddressName = ""; private string newStreetAddress = ""; private string newCity = ""; private string newPostalCode = ""; private bool isBilling, isShipping; private List orderHistory = new() { new OrderItem { OrderId = "#MB-2026-9481", ProductId = "introduction-to-blazor", ProductTitle = "Introduction to Blazor WebAssembly Framework Development", OrderDate = new DateTime(2026, 5, 20), ShippingAddressName = "Home Address", Status = "Shipped", Total = 720.00 }, new OrderItem { OrderId = "#MB-2026-8712", ProductId = "mastering-css-isolation", ProductTitle = "Mastering CSS Isolation in Modern .NET Web Applications Architecture", OrderDate = new DateTime(2026, 4, 14), ShippingAddressName = "Midrand Books Warehouse", Status = "Delivered", Total = 890.00 } }; private List savedAddresses = new() { new AddressItem { Id = 1, Name = "Home Address", Street = "12 Main Road", City = "Midrand", PostalCode = "1685", IsBilling = true, IsShipping = true, IsPrimary = true }, new AddressItem { Id = 2, Name = "Corporate Office", Street = "45 Challink Street", City = "Halfway House", PostalCode = "1682", IsBilling = true, IsShipping = false, IsPrimary = false }, new AddressItem { Id = 3, Name = "Midrand Books Warehouse", Street = "Unit 8, Corporate Park North", City = "Randjespark", PostalCode = "1683", IsBilling = false, IsShipping = true, IsPrimary = false } }; private void TriggerLogout() => Navigation.NavigateTo("/logout", forceLoad: true); private void DownloadInvoice(string orderId) { /* Handle download sequence here */ } private void OpenAddForm() { editingAddress = null; showAddForm = true; } private void SaveAddress() { if (!string.IsNullOrWhiteSpace(newAddressName) && !string.IsNullOrWhiteSpace(newStreetAddress)) { var nextId = savedAddresses.Any() ? savedAddresses.Max(a => a.Id) + 1 : 1; savedAddresses.Add(new AddressItem { Id = nextId, Name = newAddressName, Street = newStreetAddress, City = newCity, PostalCode = newPostalCode, IsBilling = isBilling, IsShipping = isShipping, IsPrimary = !savedAddresses.Any() }); ResetAddForm(); } } private void ResetAddForm() { newAddressName = ""; newStreetAddress = ""; newCity = ""; newPostalCode = ""; isBilling = isShipping = showAddForm = false; } private void StartEditing(AddressItem addr) { showAddForm = false; editingAddress = new AddressItem { Id = addr.Id, Name = addr.Name, Street = addr.Street, City = addr.City, PostalCode = addr.PostalCode, IsBilling = addr.IsBilling, IsShipping = addr.IsShipping, IsPrimary = addr.IsPrimary }; } private void CancelEditing() => editingAddress = null; private void UpdateAddress() { if (editingAddress != null) { var target = savedAddresses.FirstOrDefault(a => a.Id == editingAddress.Id); if (target != null) { target.Name = editingAddress.Name; target.Street = editingAddress.Street; target.City = editingAddress.City; target.PostalCode = editingAddress.PostalCode; target.IsBilling = editingAddress.IsBilling; target.IsShipping = editingAddress.IsShipping; } editingAddress = null; } } private void DeleteAddress(AddressItem addr) { if (editingAddress?.Id == addr.Id) editingAddress = null; savedAddresses.Remove(addr); if (addr.IsPrimary && savedAddresses.Any()) savedAddresses.First().IsPrimary = true; } private void SetPrimary(AddressItem target, ChangeEventArgs e) { var isChecked = (bool)(e.Value ?? false); if (isChecked) { foreach (var addr in savedAddresses) addr.IsPrimary = (addr.Id == target.Id); } else target.IsPrimary = false; } public class AddressItem { public int Id { get; set; } public string Name { get; set; } = ""; public string Street { get; set; } = ""; public string City { get; set; } = ""; public string PostalCode { get; set; } = ""; public bool IsBilling { get; set; } public bool IsShipping { get; set; } public bool IsPrimary { get; set; } } public class OrderItem { public string OrderId { get; set; } = ""; public string ProductId { get; set; } = ""; public string ProductTitle { get; set; } = ""; public DateTime OrderDate { get; set; } public string ShippingAddressName { get; set; } = ""; public string Status { get; set; } = ""; public double Total { get; set; } } }