Refactor authentication system to use username instead of email; implement change password functionality and logging; add NLog for logging support
Some checks failed
Publish Container / publish (push) Failing after 1m9s
Some checks failed
Publish Container / publish (push) Failing after 1m9s
This commit is contained in:
parent
d3887f1dd0
commit
6e3371514e
12 changed files with 287 additions and 45 deletions
33
Components/Pages/ChangePassword.razor
Normal file
33
Components/Pages/ChangePassword.razor
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@page "/change-password"
|
||||
@attribute [Authorize]
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components
|
||||
|
||||
<PageTitle>Change Password</PageTitle>
|
||||
|
||||
<h1>Change password</h1>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Error))
|
||||
{
|
||||
<div class="alert alert-danger" role="alert">@Error</div>
|
||||
}
|
||||
|
||||
<form method="post" action="/api/change-password" class="d-flex flex-column gap-3" style="max-width: 420px;">
|
||||
<div>
|
||||
<label for="newPassword" class="form-label">New password</label>
|
||||
<input id="newPassword" name="newPassword" type="password" autocomplete="new-password" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="confirmPassword" class="form-label">Confirm new password</label>
|
||||
<input id="confirmPassword" name="confirmPassword" type="password" autocomplete="new-password" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Change password</button>
|
||||
</form>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
public string? Error { get; set; }
|
||||
}
|
||||
|
|
@ -13,10 +13,10 @@
|
|||
<div class="alert alert-danger" role="alert">@Error</div>
|
||||
}
|
||||
|
||||
<form method="post" action="/login" class="d-flex flex-column gap-3" style="max-width: 420px;">
|
||||
<form method="post" action="/api/login" class="d-flex flex-column gap-3" style="max-width: 420px;">
|
||||
<div>
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input id="email" name="email" value="@Email" autocomplete="username" class="form-control" required />
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input id="username" name="username" value="@Username" autocomplete="username" class="form-control" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
public string? Error { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery]
|
||||
public string? Email { get; set; }
|
||||
public string? Username { get; set; }
|
||||
|
||||
private string SafeReturnUrl =>
|
||||
string.IsNullOrWhiteSpace(ReturnUrl) || !Uri.IsWellFormedUriString(ReturnUrl, UriKind.Relative)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue