Initial commit - Auth.RCL
This commit is contained in:
Executable
+98
@@ -0,0 +1,98 @@
|
||||
@page "/email-confirmed"
|
||||
@layout EmptyLayout
|
||||
@inject UserAPIConsumer userAPIConsumer
|
||||
@inject NavigationManager nav
|
||||
|
||||
|
||||
<PageTitle>Email Confirmed</PageTitle>
|
||||
|
||||
|
||||
<h1>Email Confirmed</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@*
|
||||
|
||||
|
||||
|
||||
<EditForm Model="@tokenRequestModel" OnValidSubmit="@OnValidSignIn" class="text-gray-600 body-font">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="container px-5 py-24 mx-auto flex flex-wrap items-center">
|
||||
<div class="lg:w-3/5 md:w-1/2 md:pr-16 lg:pr-0 pr-0">
|
||||
<h1 class="title-font font-medium text-3xl text-gray-900">Slow-carb next level shoindcgoitch ethical
|
||||
authentic, poko scenester</h1>
|
||||
<p class="leading-relaxed mt-4">Poke slow-carb mixtape knausgaard, typewriter street art gentrify hammock
|
||||
starladder roathse. Craies vegan tousled etsy austin.</p>
|
||||
</div>
|
||||
<div class="lg:w-2/6 md:w-1/2 bg-gray-100 rounded-lg p-8 flex flex-col md:ml-auto w-full mt-10 md:mt-0">
|
||||
<h2 class="text-gray-900 text-lg font-medium title-font mb-5">Sign In</h2>
|
||||
|
||||
<div class="relative mb-4">
|
||||
<label for="email" class="leading-7 text-sm text-gray-600">Email</label>
|
||||
<InputText type="email" placeholder="Email" @bind-Value="tokenRequestModel.Email" id="email"
|
||||
class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200
|
||||
text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out" />
|
||||
</div>
|
||||
<div class="relative mb-4">
|
||||
<label for="Password" class="leading-7 text-sm text-gray-600">Password</label>
|
||||
<InputText type="password" placeholder="Password" @bind-Value="tokenRequestModel.Password" id="Password"
|
||||
class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200
|
||||
text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out" />
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="text-white mt-4 bg-indigo-500 border-0 py-2 px-8 focus:outline-none hover:bg-indigo-600 rounded text-lg">Sign
|
||||
In</button>
|
||||
<p class="text-xs text-red-500 mt-4">@errorMessage</p>
|
||||
|
||||
<NavLink href="/ForgotPassword">Forgot Password?</NavLink>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</EditForm>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public string? Token { get; set; }
|
||||
|
||||
private TokenRequestModel tokenRequestModel = new();
|
||||
private string errorMessage = "";
|
||||
|
||||
public async Task OnValidSignIn()
|
||||
{
|
||||
var isSuccessful = await userAPIConsumer.Login(tokenRequestModel);
|
||||
if (!string.IsNullOrEmpty(Token))
|
||||
{
|
||||
if (isSuccessful)
|
||||
{
|
||||
var confirmSuccessful = await userAPIConsumer.ConfirmEmail(Token);
|
||||
if (confirmSuccessful)
|
||||
nav.NavigateTo("/");
|
||||
else
|
||||
{
|
||||
errorMessage = "Error, confirming email. try again later.";
|
||||
}
|
||||
}
|
||||
else
|
||||
errorMessage = "Wrong Email or Password.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
errorMessage = result.Message;
|
||||
}
|
||||
|
||||
} *@
|
||||
Reference in New Issue
Block a user