65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
@page "/indienen"
|
|
@using System.ComponentModel.DataAnnotations
|
|
|
|
<PageTitle>Artikel indienen — ProostenKrant</PageTitle>
|
|
|
|
<section class="card auth-card">
|
|
<span class="kicker">Medewerking gevraagd</span>
|
|
<h1 class="headline">Lever een artikel in</h1>
|
|
<p class="muted">
|
|
De ProostenKrant bestaat door bijdragen van de familie. Voer de paszin van de familie in
|
|
om een artikel te schrijven (of een eerder artikel te bewerken).
|
|
</p>
|
|
|
|
@if (_fout is not null)
|
|
{
|
|
<p class="alert alert-error">@_fout</p>
|
|
}
|
|
|
|
<EditForm FormName="paszin" Method="post" Model="Input" OnValidSubmit="Verifieer" class="krant-form">
|
|
<div class="form-group">
|
|
<label for="passphrase">Paszin</label>
|
|
<InputText type="password" @bind-Value="Input.Paszin" id="passphrase" class="form-control"
|
|
placeholder="De geheime paszin van de familie" autocomplete="off" />
|
|
<ValidationMessage For="() => Input.Paszin" />
|
|
</div>
|
|
<div class="form-actions">
|
|
<button type="submit" class="btn btn-primary">Verder naar het formulier</button>
|
|
</div>
|
|
</EditForm>
|
|
</section>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
private HttpContext HttpContext { get; set; } = default!;
|
|
|
|
[SupplyParameterFromForm(FormName = "paszin")]
|
|
private PaszinInput Input { get; set; } = new();
|
|
|
|
private string? _fout;
|
|
|
|
protected override Task OnInitializedAsync()
|
|
{
|
|
Input ??= new();
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
private sealed class PaszinInput
|
|
{
|
|
[Required(ErrorMessage = "Voer de paszin in.")]
|
|
public string Paszin { get; set; } = "";
|
|
}
|
|
|
|
private async Task Verifieer()
|
|
{
|
|
if (Input.Paszin != Krant.UniversalPassword)
|
|
{
|
|
_fout = "Onjuiste paszin. Probeer het opnieuw.";
|
|
return;
|
|
}
|
|
var principal = KrantAuth.PassphrasePrincipal();
|
|
await HttpContext.SignInAsync(KrantAuth.Scheme, principal);
|
|
Nav.NavigateTo("/indienen/formulier", forceLoad: true);
|
|
}
|
|
}
|