Initial commit - Auth.RCL
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
@page "/account/reset-password/{*token}"
|
||||
@layout EmptyLayout
|
||||
@inject UserAPIConsumer userAPIConsumer
|
||||
|
||||
|
||||
<EditForm EditContext="ec" OnValidSubmit="Reset" class="container px-5 py-24 mx-auto flex flex-wrap items-center">
|
||||
|
||||
<div class="lg:w-2/6 md:w-1/2 bg-gray-100 rounded-lg p-8 flex flex-col mx-auto w-full mt-10 md:mt-0">
|
||||
<h2 class="text-gray-900 text-lg font-medium title-font mb-5">Reset your Password</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="passwordResetModel.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="passwordResetModel.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">Reset
|
||||
Password</button>
|
||||
<p class='text-md text-center font-bold @(isSuccessful ? "text-green-500" : "text-red-500") mt-4'>@resultMessage
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public string Token { get; set; }
|
||||
|
||||
PasswordResetModel passwordResetModel = new();
|
||||
@* string status = "Confirming..."; *@
|
||||
|
||||
string resultMessage = "";
|
||||
|
||||
bool isSuccessful = false;
|
||||
EditContext ec;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ec = new EditContext(passwordResetModel);
|
||||
}
|
||||
|
||||
async Task Reset()
|
||||
{
|
||||
resultMessage = "";
|
||||
passwordResetModel.Token = Token;
|
||||
if (ec.Validate())
|
||||
{
|
||||
isSuccessful = await userAPIConsumer.ResetPassword(passwordResetModel);
|
||||
if (isSuccessful)
|
||||
resultMessage = "Password reset successful.";
|
||||
else
|
||||
resultMessage = "Error, Try Again later";
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user