web: registrace, ověření e-mailu, obnova hesla a profil

Stránky na cestách z e-mailových odkazů API (/confirm-email, /reset-password).
Token se spotřebuje až tlačítkem, ne otevřením odkazu (poštovní skenery).
Profil s úpravou jména, telefonu a e-mailových upozornění, odhlášení ze všech
zařízení. Chyby validace z API se zobrazují u polí formuláře.

Refs #21
This commit is contained in:
PatTheEvil committed 2026-12-02 00:31:07 +01:00
1 parent d3a1b1cb17
commit 3965a8a2a1
16 files changed
+566 -1

No files matched your search

+26
View File
@@ -15,6 +15,32 @@ public sealed class AuthApiClient(HttpClient http)
return await ApiResponse.ReadAsync<AuthResponse>(response, ct);
}
/// <summary>Registrace. Roli (student / vyučující) určí API podle domény e-mailu.</summary>
public async Task<UserDto> RegisterAsync(RegisterRequest request, CancellationToken ct)
{
using var response = await http.PostAsJsonAsync("api/v1/auth/register", request, ct);
return await ApiResponse.ReadAsync<UserDto>(response, ct);
}
public async Task ConfirmEmailAsync(string token, CancellationToken ct)
{
using var response = await http.PostAsJsonAsync("api/v1/auth/confirm-email", new EmailTokenRequest(token), ct);
await ApiResponse.EnsureSuccessAsync(response, ct);
}
/// <summary>API odpoví stejně, ať účet existuje, nebo ne – stránka tak neprozradí registrované e-maily.</summary>
public async Task ForgotPasswordAsync(string email, CancellationToken ct)
{
using var response = await http.PostAsJsonAsync("api/v1/auth/forgot-password", new ForgotPasswordRequest(email), ct);
await ApiResponse.EnsureSuccessAsync(response, ct);
}
public async Task ResetPasswordAsync(ResetPasswordRequest request, CancellationToken ct)
{
using var response = await http.PostAsJsonAsync("api/v1/auth/reset-password", request, ct);
await ApiResponse.EnsureSuccessAsync(response, ct);
}
/// <summary>Obnoví pár tokenů. Neplatný nebo už použitý refresh token → <c>null</c>.</summary>
public async Task<TokenSet?> RefreshAsync(string refreshToken, CancellationToken ct)
{