Enhance ForgotPassword, Login, and ResetPassword pages: add error message display and adjust heading styles
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Server.BaseClasses;
|
||||
using FoodsharingSiegen.Server.Auth;
|
||||
@@ -15,19 +16,30 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
public bool IsSubmitted { get; set; }
|
||||
public bool IsLoading { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
|
||||
public async Task SubmitRequest()
|
||||
{
|
||||
if (IsValidMail != ValidationStatus.Success) return;
|
||||
|
||||
IsLoading = true;
|
||||
ErrorMessage = null;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
await AuthService.InitiatePasswordReset(MailAddress, NavigationManager.BaseUri);
|
||||
|
||||
IsSubmitted = true;
|
||||
IsLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
try
|
||||
{
|
||||
await AuthService.InitiatePasswordReset(MailAddress, NavigationManager.BaseUri);
|
||||
IsSubmitted = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
ErrorMessage = "Es gab ein Problem bei der Verarbeitung der Anfrage. Bitte versuche es später erneut oder wende dich an einen Administrator.";
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task TextEdit_KeyUp(KeyboardEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user