Separate dashboard port, first-run password setup and default trusted proxies

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-11-14 17:21:49 +01:00
1 parent a34ff96490
commit c22d452720
25 files changed
+654 -109

No files matched your search

@@ -0,0 +1,63 @@
@using Flypaper.Web.Auth
@inject AdminAuthenticator Admin
@inject NavigationManager Navigation
<section class="card form">
<h2>Admin-Passwort</h2>
@if (Changed == "changed")
{
<div class="banner ok">Passwort geändert.</div>
}
@if (Admin.UsesEnvironmentPassword)
{
<p class="muted">Das Passwort kommt aus der Umgebungsvariable <code>Flypaper__Admin__Password</code> und lässt sich nur dort ändern.</p>
}
else
{
<EditForm Model="Model" FormName="password" OnSubmit="ChangeAsync" action="/settings" class="form">
<label for="current-password">Aktuelles Passwort</label>
<InputText id="current-password" type="password" autocomplete="current-password" @bind-Value="Model!.Current" />
<FieldError Errors="_errors" Field="@nameof(PasswordModel.Current)" />
<label for="new-password">Neues Passwort <span class="muted">(mindestens @AdminAuthenticator.MinimumPasswordLength Zeichen)</span></label>
<InputText id="new-password" type="password" autocomplete="new-password" @bind-Value="Model!.New" />
<label for="confirm-password">Neues Passwort wiederholen</label>
<InputText id="confirm-password" type="password" autocomplete="new-password" @bind-Value="Model!.Confirmation" />
<FieldError Errors="_errors" Field="@nameof(PasswordModel.New)" />
<div class="actions">
<button type="submit">Passwort ändern</button>
</div>
</EditForm>
}
</section>
@code {
private readonly Dictionary<string, string> _errors = [];
[SupplyParameterFromForm(FormName = "password")] private PasswordModel? Model { get; set; }
[SupplyParameterFromQuery(Name = "password")] private string? Changed { get; set; }
protected override void OnInitialized() => Model ??= new PasswordModel();
private async Task ChangeAsync()
{
if (AdminAuthenticator.ValidateNewPassword(Model!.New, Model.Confirmation) is { } error)
{
_errors[nameof(PasswordModel.New)] = error;
return;
}
if (!await Admin.TryChangePasswordAsync(Model.Current ?? "", Model.New!))
{
_errors[nameof(PasswordModel.Current)] = "Aktuelles Passwort falsch.";
return;
}
Navigation.NavigateTo("/settings?password=changed");
}
}