Password reset implemented partialy

This commit is contained in:
Marcel Baumgartner
2023-03-12 21:36:35 +01:00
parent 45defd7903
commit 5b019bc953
8 changed files with 187 additions and 11 deletions

View File

@@ -72,7 +72,7 @@
<div class="d-flex flex-stack flex-wrap gap-3 fs-base fw-semibold mb-8">
<div></div>
<a href="/reset-password" class="link-primary">
<a href="/passwordreset" class="link-primary">
<TL>Forgot password?</TL>
</a>
</div>

View File

@@ -0,0 +1,73 @@
@page "/passwordreset"
@using Moonlight.App.Services
@* This is just a "virtual" route/page. The handling for that is
@* MainLayout doing for us. We need to put that here so the router
@* does not return the 404 page
*@
@inject UserService UserService
@inject SmartTranslateService SmartTranslateService
<div class="d-flex flex-center">
<div class="card rounded-3 w-md-550px">
<div class="card-body">
<div class="d-flex flex-center flex-column-fluid pb-15 pb-lg-20">
@if (Send)
{
<div class="text-center mb-11">
<h1 class="text-dark fw-bolder mb-3">
<TL>Passwort reset successfull. Check your mail</TL>
</h1>
</div>
}
else
{
<div class="form w-100 fv-plugins-bootstrap5 fv-plugins-framework" novalidate="novalidate">
<div class="text-center mb-11">
<h1 class="text-dark fw-bolder mb-3">
<TL>Password reset</TL>
</h1>
<div class="text-gray-500 fw-semibold fs-6">
<TL>Reset the password of your account</TL>
</div>
</div>
<div class="fv-row mb-8 fv-plugins-icon-container">
<input @bind="Email" type="email" placeholder="@(SmartTranslateService.Translate("Email"))" name="email" class="form-control bg-transparent">
</div>
<div class="d-grid mb-10">
<WButton Text="@(SmartTranslateService.Translate("Reset password"))"
WorkingText="@(SmartTranslateService.Translate("Working"))"
CssClasses="btn-primary"
OnClick="Submit">
</WButton>
</div>
<div class="text-gray-500 text-center fw-semibold fs-6">
<TL>Wrong here?</TL>
<a href="/login" class="link-primary">
<TL>Sign in</TL>
</a>
</div>
</div>
}
</div>
</div>
</div>
</div>
@code
{
private string Email = "";
private bool Send = false;
private async Task Submit()
{
await UserService.ResetPassword(Email);
Send = true;
await InvokeAsync(StateHasChanged);
}
}