Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
@inject NavigationManager Nav
|
||||
@inject IJSRuntime JS
|
||||
@inject SharepointToolbox.Web.Services.OAuth.IOAuthFlowCache OAuthCache
|
||||
@inject SharepointToolbox.Web.Infrastructure.Persistence.ProfileRepository ProfileRepo
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
@using Microsoft.JSInterop
|
||||
@@ -112,6 +113,9 @@
|
||||
<main class="content">
|
||||
@if (UserContext.IsAuthenticated)
|
||||
{
|
||||
<header class="topbar">
|
||||
<ProfileSelector />
|
||||
</header>
|
||||
@Body
|
||||
}
|
||||
else
|
||||
@@ -222,9 +226,20 @@
|
||||
{
|
||||
await CredStore.SetAsync(tokens);
|
||||
await SessionManager.ClearAllAsync();
|
||||
|
||||
// Re-select the profile that started this connect flow. The forceLoad redirect tore
|
||||
// down the previous circuit, so the in-memory selection in UserSessionService (scoped)
|
||||
// was lost. Restoring it here means a successful auth lands the user on a fully
|
||||
// selected profile instead of forcing a second "Select" click.
|
||||
if (query.TryGetValue("profile_id", out var profileId) && !string.IsNullOrEmpty(profileId))
|
||||
{
|
||||
var profile = (await ProfileRepo.LoadAsync()).FirstOrDefault(p => p.Id == profileId);
|
||||
if (profile is not null)
|
||||
Session.SetProfile(profile);
|
||||
}
|
||||
}
|
||||
|
||||
// Strip token_key from URL bar
|
||||
// Strip token_key / profile_id from URL bar
|
||||
Nav.NavigateTo(uri.GetLeftPart(UriPartial.Path), replace: true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user