Implement password recovery feature with reset token and email notifications
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m28s
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m28s
This commit is contained in:
41
FoodsharingSiegen.Server/Pages/ForgotPassword.razor.cs
Normal file
41
FoodsharingSiegen.Server/Pages/ForgotPassword.razor.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Server.BaseClasses;
|
||||
using FoodsharingSiegen.Server.Auth;
|
||||
using FoodsharingSiegen.Shared.Helper;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
{
|
||||
public partial class ForgotPassword : FsBase
|
||||
{
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
public ValidationStatus IsValidMail { get; set; } = ValidationStatus.None;
|
||||
|
||||
public bool IsSubmitted { get; set; }
|
||||
public bool IsLoading { get; set; }
|
||||
|
||||
public async Task SubmitRequest()
|
||||
{
|
||||
if (IsValidMail != ValidationStatus.Success) return;
|
||||
|
||||
IsLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
await AuthService.InitiatePasswordReset(MailAddress, NavigationManager.BaseUri);
|
||||
|
||||
IsSubmitted = true;
|
||||
IsLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public async Task TextEdit_KeyUp(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Key == "Enter" && IsValidMail == ValidationStatus.Success)
|
||||
{
|
||||
await SubmitRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user