🐛 Bug fixes in auth factor endpoints

This commit is contained in:
LittleSheep 2025-06-06 00:55:20 +08:00
parent b6aa0e83a3
commit aef6c60621

View File

@ -362,7 +362,7 @@ public class AccountCurrentController(
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
var factor = await db.AccountAuthFactors var factor = await db.AccountAuthFactors
.Where(f => f.AccountId == id && f.Id == id) .Where(f => f.AccountId == currentUser.Id && f.Id == id)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (factor is null) return NotFound(); if (factor is null) return NotFound();
@ -384,7 +384,7 @@ public class AccountCurrentController(
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
var factor = await db.AccountAuthFactors var factor = await db.AccountAuthFactors
.Where(f => f.AccountId == id && f.Id == id) .Where(f => f.AccountId == currentUser.Id && f.Id == id)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (factor is null) return NotFound(); if (factor is null) return NotFound();
@ -406,7 +406,7 @@ public class AccountCurrentController(
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
var factor = await db.AccountAuthFactors var factor = await db.AccountAuthFactors
.Where(f => f.AccountId == id && f.Id == id) .Where(f => f.AccountId == currentUser.Id && f.Id == id)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (factor is null) return NotFound(); if (factor is null) return NotFound();