🐛 Serval bug fixes and improvement to web page
This commit is contained in:
@ -11,6 +11,14 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h1 class="card-title justify-center text-2xl font-bold">Select Authentication Method</h1>
|
<h1 class="card-title justify-center text-2xl font-bold">Select Authentication Method</h1>
|
||||||
|
|
||||||
|
@if (Model.AuthChallenge != null && Model.AuthChallenge.StepRemain > 0)
|
||||||
|
{
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<p class="text-sm text-info mb-2">Progress: @(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain) of @Model.AuthChallenge.StepTotal steps completed</p>
|
||||||
|
<progress class="progress progress-info w-full" value="@(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain)" max="@Model.AuthChallenge.StepTotal"></progress>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
@if (Model.AuthChallenge == null)
|
@if (Model.AuthChallenge == null)
|
||||||
{
|
{
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
|
@ -34,6 +34,14 @@
|
|||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@if (Model.AuthChallenge != null && Model.AuthChallenge.StepRemain > 0)
|
||||||
|
{
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<p class="text-sm text-info mb-2">Progress: @(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain) of @Model.AuthChallenge.StepTotal steps completed</p>
|
||||||
|
<progress class="progress progress-info w-full" value="@(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain)" max="@Model.AuthChallenge.StepTotal"></progress>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
@if (Model.AuthChallenge == null)
|
@if (Model.AuthChallenge == null)
|
||||||
{
|
{
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
@ -51,7 +59,12 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<form method="post" class="space-y-4">
|
<form method="post" class="space-y-4">
|
||||||
<div asp-validation-summary="ModelOnly" class="text-error text-sm"></div>
|
@if (!ViewData.ModelState.IsValid && ViewData.ModelState.Any(m => m.Value.Errors.Any()))
|
||||||
|
{
|
||||||
|
<div role="alert" class="alert alert-error mb-4">
|
||||||
|
<span>@Html.ValidationSummary(true)</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label asp-for="Code" class="label">
|
<label asp-for="Code" class="label">
|
||||||
|
@ -32,6 +32,10 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
|||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync()
|
public async Task<IActionResult> OnGetAsync()
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrEmpty(ReturnUrl))
|
||||||
|
{
|
||||||
|
TempData["ReturnUrl"] = ReturnUrl;
|
||||||
|
}
|
||||||
await LoadChallengeAndFactor();
|
await LoadChallengeAndFactor();
|
||||||
if (AuthChallenge == null) return NotFound("Challenge not found or expired.");
|
if (AuthChallenge == null) return NotFound("Challenge not found or expired.");
|
||||||
if (Factor == null) return NotFound("Authentication method not found.");
|
if (Factor == null) return NotFound("Authentication method not found.");
|
||||||
@ -42,6 +46,10 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
|||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrEmpty(ReturnUrl))
|
||||||
|
{
|
||||||
|
TempData["ReturnUrl"] = ReturnUrl;
|
||||||
|
}
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
await LoadChallengeAndFactor();
|
await LoadChallengeAndFactor();
|
||||||
@ -52,6 +60,12 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
|||||||
if (AuthChallenge == null) return NotFound("Challenge not found or expired.");
|
if (AuthChallenge == null) return NotFound("Challenge not found or expired.");
|
||||||
if (Factor == null) return NotFound("Authentication method not found.");
|
if (Factor == null) return NotFound("Authentication method not found.");
|
||||||
|
|
||||||
|
if (AuthChallenge.BlacklistFactors.Contains(Factor.Id))
|
||||||
|
{
|
||||||
|
ModelState.AddModelError(string.Empty, "This authentication method has already been used for this challenge.");
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (await accounts.VerifyFactorCode(Factor, Code))
|
if (await accounts.VerifyFactorCode(Factor, Code))
|
||||||
@ -160,7 +174,7 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
|||||||
Response.Cookies.Append(AuthConstants.CookieTokenName, token, new CookieOptions
|
Response.Cookies.Append(AuthConstants.CookieTokenName, token, new CookieOptions
|
||||||
{
|
{
|
||||||
HttpOnly = true,
|
HttpOnly = true,
|
||||||
Secure = !configuration.GetValue<bool>("Debug"),
|
Secure = Request.IsHttps,
|
||||||
SameSite = SameSiteMode.Strict,
|
SameSite = SameSiteMode.Strict,
|
||||||
Path = "/"
|
Path = "/"
|
||||||
});
|
});
|
||||||
|
@ -2228,6 +2228,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.progress-info {
|
||||||
|
color: var(--color-info);
|
||||||
|
}
|
||||||
.text-base-content\/70 {
|
.text-base-content\/70 {
|
||||||
color: var(--color-base-content);
|
color: var(--color-base-content);
|
||||||
@supports (color: color-mix(in lab, red, red)) {
|
@supports (color: color-mix(in lab, red, red)) {
|
||||||
@ -2240,6 +2243,9 @@
|
|||||||
.text-error {
|
.text-error {
|
||||||
color: var(--color-error);
|
color: var(--color-error);
|
||||||
}
|
}
|
||||||
|
.text-info {
|
||||||
|
color: var(--color-info);
|
||||||
|
}
|
||||||
.text-neutral-content {
|
.text-neutral-content {
|
||||||
color: var(--color-neutral-content);
|
color: var(--color-neutral-content);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user