2026-03-17 20:08:02 +01:00
|
|
|
@page "/change-password"
|
|
|
|
|
@attribute [Authorize]
|
|
|
|
|
|
|
|
|
|
@using Microsoft.AspNetCore.Authorization
|
|
|
|
|
@using Microsoft.AspNetCore.Components
|
2026-04-20 14:11:18 +02:00
|
|
|
@using Microsoft.Extensions.Options
|
|
|
|
|
@using WorkTracker.Configuration
|
|
|
|
|
|
|
|
|
|
@inject IOptions<AppAuthOptions> AppAuthOptions
|
|
|
|
|
@inject NavigationManager Navigation
|
2026-03-17 20:08:02 +01:00
|
|
|
|
|
|
|
|
<PageTitle>Change Password</PageTitle>
|
|
|
|
|
|
2026-04-20 14:11:18 +02:00
|
|
|
@if (!AppAuthOptions.Value.Enabled)
|
|
|
|
|
{
|
|
|
|
|
<p>Redirecting...</p>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-03-17 20:08:02 +01:00
|
|
|
<h1>Change password</h1>
|
|
|
|
|
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(Error))
|
|
|
|
|
{
|
|
|
|
|
<div class="alert alert-danger" role="alert">@Error</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<form method="post" action="/api/change-password" class="d-flex flex-column gap-3" style="max-width: 420px;">
|
|
|
|
|
<div>
|
|
|
|
|
<label for="newPassword" class="form-label">New password</label>
|
|
|
|
|
<input id="newPassword" name="newPassword" type="password" autocomplete="new-password" class="form-control" required />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label for="confirmPassword" class="form-label">Confirm new password</label>
|
|
|
|
|
<input id="confirmPassword" name="confirmPassword" type="password" autocomplete="new-password" class="form-control" required />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">Change password</button>
|
|
|
|
|
</form>
|
2026-04-20 14:11:18 +02:00
|
|
|
}
|
2026-03-17 20:08:02 +01:00
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[SupplyParameterFromQuery]
|
|
|
|
|
public string? Error { get; set; }
|
2026-04-20 14:11:18 +02:00
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
if (!AppAuthOptions.Value.Enabled)
|
|
|
|
|
{
|
|
|
|
|
Navigation.NavigateTo("/", forceLoad: true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-17 20:08:02 +01:00
|
|
|
}
|