@page "/validate/{userId}/{renewToken}"
@inherits BasePageComponent
@using TIAM.Models.Dtos.Users
@using TIAM.Services
@using TIAMSharedUI.Shared.Components.BaseComponents
@using BlazorAnimation
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models.PageModels;
@using TIAMSharedUI.Pages.Components;
@using TIAMSharedUI.Pages.User.CardComponents
@using TIAMWebApp.Shared.Application.Services
@inject IUserDataService UserDataService
@inject AdminSignalRClient AdminSignalRClient
Validate Email
Validate email
Let's validate your email!
@code {
[Parameter] public string? userId { get; set; } = "";
[Parameter] public string? renewToken { get; set; } = "";
private bool isFormHidden = true;
string resultMsg = "";
private UserModelDtoDetail? user = new UserModelDtoDetail();
protected override async Task OnInitializedAsync()
{
if (userId != null && renewToken != null)
{
string msg = await UserDataService.ValidateForgotPasswordToken(Guid.Parse(userId), renewToken);
if (msg == "Success")
{
var result = await UserDataService.SetEmailConfirmed(Guid.Parse(userId));
if (result)
{
resultMsg = "Email validated, you can now login";
}
else
{
resultMsg = "Oops, something went wrong";
}
}
else
{
resultMsg = msg;
}
}
await base.OnInitializedAsync();
}
protected override async Task OnParametersSetAsync()
{
//validate Token
await base.OnParametersSetAsync();
}
}