From 026c405cd4c698c4936767047897f6d894380767 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 7 Jun 2025 20:59:26 +0800 Subject: [PATCH] :necktie: New calculation formula for authenticate steps --- DysonNetwork.Sphere/Auth/AuthService.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/DysonNetwork.Sphere/Auth/AuthService.cs b/DysonNetwork.Sphere/Auth/AuthService.cs index e60eeb3..6efb653 100644 --- a/DysonNetwork.Sphere/Auth/AuthService.cs +++ b/DysonNetwork.Sphere/Auth/AuthService.cs @@ -55,11 +55,9 @@ public class AuthService(AppDatabase db, IConfiguration config, IHttpClientFacto riskScore += 1; // 4) Combine base “maxSteps” (the number of enabled factors) with any accumulated risk score. - // You might choose to make “maxSteps + riskScore” your total required steps, - // or clamp it to maxSteps if you only want to require existing available factors. - var totalRequiredSteps = maxSteps + riskScore; - - // Clamp the step + const int totalRiskScore = 3; + var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / 3); + // Clamp the steps totalRequiredSteps = Math.Max(Math.Min(totalRequiredSteps, maxSteps), 1); return totalRequiredSteps;