Removed auth
All checks were successful
Publish Container / publish (push) Successful in 5m35s

This commit is contained in:
Marco 2026-04-20 14:11:18 +02:00
commit 08e573d63c
17 changed files with 348 additions and 26 deletions

View file

@ -3,9 +3,20 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components
@using Microsoft.Extensions.Options
@using WorkTracker.Configuration
@inject IOptions<AppAuthOptions> AppAuthOptions
@inject NavigationManager Navigation
<PageTitle>Change Password</PageTitle>
@if (!AppAuthOptions.Value.Enabled)
{
<p>Redirecting...</p>
}
else
{
<h1>Change password</h1>
@if (!string.IsNullOrWhiteSpace(Error))
@ -26,8 +37,17 @@
<button type="submit" class="btn btn-primary">Change password</button>
</form>
}
@code {
[SupplyParameterFromQuery]
public string? Error { get; set; }
protected override void OnInitialized()
{
if (!AppAuthOptions.Value.Enabled)
{
Navigation.NavigateTo("/", forceLoad: true);
}
}
}

View file

@ -3,9 +3,20 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components
@using Microsoft.Extensions.Options
@using WorkTracker.Configuration
@inject IOptions<AppAuthOptions> AppAuthOptions
@inject NavigationManager Navigation
<PageTitle>Login</PageTitle>
@if (!AppAuthOptions.Value.Enabled)
{
<p>Redirecting...</p>
}
else
{
<h1>Login</h1>
@if (!string.IsNullOrWhiteSpace(Error))
@ -28,6 +39,7 @@
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
}
@code {
[SupplyParameterFromQuery]
@ -39,6 +51,14 @@
[SupplyParameterFromQuery]
public string? Username { get; set; }
protected override void OnInitialized()
{
if (!AppAuthOptions.Value.Enabled)
{
Navigation.NavigateTo(SafeReturnUrl, forceLoad: true);
}
}
private string SafeReturnUrl =>
string.IsNullOrWhiteSpace(ReturnUrl) || !Uri.IsWellFormedUriString(ReturnUrl, UriKind.Relative)
? "/"