- About
-
+
+
-
- @Body
-
-
+
+ @Body
+
+
+
diff --git a/src/Web/Components/Layout/NavMenu.razor b/src/Web/Components/Layout/NavMenu.razor
index cb3e952e..ded685bd 100644
--- a/src/Web/Components/Layout/NavMenu.razor
+++ b/src/Web/Components/Layout/NavMenu.razor
@@ -1,62 +1,200 @@
@using Microsoft.AspNetCore.Components.Authorization
+@inject IJSRuntime Js
+@inject NavigationManager Nav
+@implements IDisposable
+@rendermode InteractiveServer
-
-
-
-
-
+
+
+@code {
+ private string _currentColor = "blue";
+ private string _currentBrightness = "light";
+
+ protected override void OnInitialized()
+ {
+ Nav.LocationChanged += OnLocationChanged;
+ }
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (firstRender)
+ {
+ await SyncThemeFromJs();
+ }
+ }
+
+ private async void OnLocationChanged(object? sender, LocationChangedEventArgs e)
+ {
+ try
+ {
+ await InvokeAsync(SyncThemeFromJs);
+ }
+ catch
+ {
+ }
+ }
+
+ private async Task SyncThemeFromJs()
+ {
+ try
+ {
+ _currentColor = await Js.InvokeAsyncHello, world!
+Hello, users!
-Welcome to your new app. +Welcome to your new app.
diff --git a/src/Web/Features/UserManagement/ManageRoles.razor b/src/Web/Features/UserManagement/ManageRoles.razor index 29352105..0fed4a99 100644 --- a/src/Web/Features/UserManagement/ManageRoles.razor +++ b/src/Web/Features/UserManagement/ManageRoles.razor @@ -8,63 +8,65 @@Manage User Roles
+Manage User Roles
@if (_loading) { -Loading users...
+Loading users...
} else { @if (_error is not null) { -
- @_error
-
+
-
-
+
}
@code {
diff --git a/src/Web/Features/UserManagement/Profile.razor b/src/Web/Features/UserManagement/Profile.razor
new file mode 100644
index 00000000..296b53db
--- /dev/null
+++ b/src/Web/Features/UserManagement/Profile.razor
@@ -0,0 +1,198 @@
+@page "/profile"
+@using System.Security.Claims
+@using Microsoft.AspNetCore.Authorization
+@using MyBlog.Web.Security
+@attribute [Authorize]
+
+
+ @_error
+
}
@if (_availableRoles.Any())
{
- Available roles: @string.Join(", ", _availableRoles.Select(r => r.Name))
+Available roles: @string.Join(", ", _availableRoles.Select(r => r.Name))
} -| User | -Current Roles | -Actions | -
|---|
| @user.Name | -@user.Email | -@string.Join(", ", user.Roles) | -- @foreach (var role in _availableRoles.Where(r => !user.Roles.Contains(r.Name))) - { - - } - @foreach (var role in _availableRoles.Where(r => user.Roles.Contains(r.Name))) - { - - } - | +User | +Current Roles | +Actions |
|---|
User Profile
+ +@if (_user is null) +{ +Loading profile...
+} +else +{ +
+
+
+
+
+
+
+}
+
+@code {
+ [CascadingParameter]
+ private Task
+ @if (!string.IsNullOrWhiteSpace(_pictureUrl))
+ {
+
+ }
+ else
+ {
+
+
+
+ @_initials
+
+ }
+
+
+
+ @_displayName
+@_emailAddress
+ @if (!string.IsNullOrWhiteSpace(_userId)) + { +User ID: @_userId
+ } +
+
+
+
+
+ Identity
+-
+
- Authenticated +
- @(_user.Identity?.IsAuthenticated == true ? "Yes" : "No") +
- Authentication Type +
- @(_user.Identity?.AuthenticationType ?? "Unknown") +
+
+
+
+
+
+ Roles
+ @if (_roles.Count > 0) + { +
+ @foreach (var role in _roles)
+ {
+ @role
+ }
+
+ }
+ else
+ {
+ No roles found in the current claims.
+ } +
+
+
+ @if (_claims.Count == 0)
+ {
+ Claims
+Claims currently present on your authenticated user principal.
+
+
+ }
+ else
+ {
+ No claims were found.
+
+
+
+
+
+ }
+ | Claim Type | +Value | +
|---|---|
| @claim.Type | +@claim.Value | +