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