86 lines
2.3 KiB
Plaintext
86 lines
2.3 KiB
Plaintext
@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
|
|
|
|
<PageTitle>Validate Email</PageTitle>
|
|
|
|
<div class="text-center m-5">
|
|
<h1>Validate email</h1>
|
|
<h2 style="font-size:small">Let's validate your email!</h2>
|
|
</div>
|
|
|
|
|
|
<div class="container mt-3">
|
|
<div class="row d-flex justify-content-center align-items-center h-100">
|
|
<div class="col-12 col-sm-6 px-5">
|
|
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Slow" Delay="@TimeSpan.FromMilliseconds(250)">
|
|
<div class="card my-5">
|
|
|
|
<p>@resultMsg</p>
|
|
|
|
</div>
|
|
</Animation>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
@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();
|
|
}
|
|
|
|
|
|
|
|
}
|