♻️ No idea, but errors all gone
This commit is contained in:
@@ -11,13 +11,13 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DysonNetwork.Sphere.Pages.Auth
|
||||
{
|
||||
public class LoginModel(
|
||||
AppDatabase db,
|
||||
DysonNetwork.Shared.Services.IAccountService accounts,
|
||||
DysonNetwork.Pass.Auth.AuthService auth,
|
||||
GeoIpService geo,
|
||||
DysonNetwork.Shared.Services.IActionLogService als
|
||||
) : PageModel
|
||||
{
|
||||
|
||||
[BindProperty] [Required] public string Username { get; set; } = string.Empty;
|
||||
|
||||
[BindProperty]
|
||||
@@ -52,13 +52,7 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
||||
var userAgent = HttpContext.Request.Headers.UserAgent.ToString();
|
||||
var now = Instant.FromDateTimeUtc(DateTime.UtcNow);
|
||||
|
||||
var existingChallenge = await db.AuthChallenges
|
||||
.Where(e => e.Account == account)
|
||||
.Where(e => e.IpAddress == ipAddress)
|
||||
.Where(e => e.UserAgent == userAgent)
|
||||
.Where(e => e.StepRemain > 0)
|
||||
.Where(e => e.ExpiredAt != null && now < e.ExpiredAt)
|
||||
.FirstOrDefaultAsync();
|
||||
var existingChallenge = await accounts.GetAuthChallenge(account.Id, ipAddress, userAgent, now);
|
||||
|
||||
if (existingChallenge is not null)
|
||||
{
|
||||
@@ -79,8 +73,7 @@ namespace DysonNetwork.Sphere.Pages.Auth
|
||||
AccountId = account.Id
|
||||
}.Normalize();
|
||||
|
||||
await db.AuthChallenges.AddAsync(challenge);
|
||||
await db.SaveChangesAsync();
|
||||
await accounts.CreateAuthChallenge(challenge);
|
||||
|
||||
// If we have a return URL, pass it to the verify page
|
||||
if (TempData.TryGetValue("ReturnUrl", out var returnUrl) && returnUrl is string url)
|
||||
|
||||
Reference in New Issue
Block a user