6acbc4e852
This commit updates the authentication process to include a return URL parameter, allowing users to be redirected back to their original page after logging in. Changes were made to the AuthController, Login component, and Routes component to handle the return URL appropriately. Additionally, improvements were made to the TeamScheduler and TeamSchedulerSolution classes for better team and student management. These enhancements improve user experience and navigation within the application.
24 lines
1015 B
Plaintext
24 lines
1015 B
Plaintext
@inject NavigationManager navigationManager
|
|
|
|
<Router AppAssembly="typeof(Program).Assembly">
|
|
<Found Context="routeData">
|
|
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
|
<NotAuthorized>
|
|
@{
|
|
var currentUri = navigationManager.Uri;
|
|
var baseUri = navigationManager.BaseUri;
|
|
var relativePath = currentUri.Replace(baseUri, "").TrimStart('/');
|
|
var returnUrl = string.IsNullOrEmpty(relativePath) ? "/" : "/" + relativePath;
|
|
var encodedReturnUrl = Uri.EscapeDataString(returnUrl);
|
|
navigationManager.NavigateTo($"/login?returnUrl={encodedReturnUrl}", true);
|
|
}
|
|
</NotAuthorized>
|
|
</AuthorizeRouteView>
|
|
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
|
|
</Found>
|
|
<NotFound>
|
|
@{
|
|
navigationManager.NavigateTo("/login", true);
|
|
}
|
|
</NotFound>
|
|
</Router> |