🐛 Serval bug fixes
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
@page "/web/auth/login"
|
||||
@model DysonNetwork.Sphere.Pages.Auth.LoginModel
|
||||
@{
|
||||
ViewData["Title"] = "Login";
|
||||
ViewData["Title"] = "Login | Solar Network";
|
||||
var returnUrl = Model.ReturnUrl ?? "";
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
@using DysonNetwork.Sphere.Account
|
||||
@model DysonNetwork.Sphere.Pages.Auth.SelectFactorModel
|
||||
@{
|
||||
ViewData["Title"] = "Select Authentication Method";
|
||||
ViewData["Title"] = "Select Authentication Method | Solar Network";
|
||||
}
|
||||
|
||||
<div class="hero min-h-full bg-base-200">
|
||||
|
@ -2,7 +2,7 @@
|
||||
@using DysonNetwork.Sphere.Account
|
||||
@model DysonNetwork.Sphere.Pages.Auth.VerifyFactorModel
|
||||
@{
|
||||
ViewData["Title"] = "Verify Your Identity";
|
||||
ViewData["Title"] = "Verify Your Identity | Solar Network";
|
||||
}
|
||||
|
||||
<div class="hero min-h-full bg-base-200">
|
||||
|
@ -39,7 +39,7 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
||||
await LoadChallengeAndFactor();
|
||||
if (AuthChallenge == null) return NotFound("Challenge not found or expired.");
|
||||
if (Factor == null) return NotFound("Authentication method not found.");
|
||||
if (AuthChallenge.StepRemain == 0) return await ExchangeTokenAndRedirect();
|
||||
if (AuthChallenge.StepRemain == 0) return await ExchangeTokenAndRedirect(AuthChallenge);
|
||||
|
||||
return Page();
|
||||
}
|
||||
@ -93,7 +93,7 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
||||
{ "account_id", AuthChallenge.AccountId }
|
||||
}, Request, AuthChallenge.Account);
|
||||
|
||||
return await ExchangeTokenAndRedirect();
|
||||
return await ExchangeTokenAndRedirect(AuthChallenge);
|
||||
}
|
||||
|
||||
else
|
||||
@ -145,14 +145,10 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<IActionResult> ExchangeTokenAndRedirect()
|
||||
private async Task<IActionResult> ExchangeTokenAndRedirect(Challenge challenge)
|
||||
{
|
||||
var challenge = await db.AuthChallenges
|
||||
.Include(e => e.Account)
|
||||
.FirstOrDefaultAsync(e => e.Id == Id);
|
||||
|
||||
if (challenge == null) return BadRequest("Authorization code not found or expired.");
|
||||
if (challenge.StepRemain != 0) return BadRequest("Challenge not yet completed.");
|
||||
await db.Entry(challenge).ReloadAsync();
|
||||
if (challenge.StepRemain != 0) return BadRequest($"Challenge not yet completed. Remaining steps: {challenge.StepRemain}");
|
||||
|
||||
var session = await db.AuthSessions
|
||||
.FirstOrDefaultAsync(e => e.ChallengeId == challenge.Id);
|
||||
|
@ -1,7 +1,7 @@
|
||||
@page
|
||||
@model IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "The Solar Network";
|
||||
ViewData["Title"] = "The Solar Network | Solar Network";
|
||||
}
|
||||
|
||||
<div class="hero min-h-full bg-base-200">
|
||||
|
@ -34,6 +34,7 @@ public static class ApplicationConfiguration
|
||||
app.UseWebSockets();
|
||||
app.UseRateLimiter();
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseMiddleware<PermissionMiddleware>();
|
||||
|
||||
|
Reference in New Issue
Block a user