refactor: compact two factor auth

This commit is contained in:
nikita 2024-12-26 16:16:33 +03:00
parent 516ba5bb8e
commit 0c6d1c9bfb

View File

@ -253,11 +253,8 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
/// <returns>A boolean indicating whether the two-factor authentication was successful.</returns> /// <returns>A boolean indicating whether the two-factor authentication was successful.</returns>
[HttpPost("2FA")] [HttpPost("2FA")]
[BadRequestResponse] [BadRequestResponse]
public async Task<ActionResult<bool>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request) public async Task<ActionResult<bool>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request) =>
{ await auth.LoginAsync(GetCookieParams(), HttpContext, request.Method.ConvertFromDto(), request.Code);
var tokenResult = await auth.LoginAsync(GetCookieParams(), HttpContext, request.Method.ConvertFromDto(), request.Code);
return Ok(tokenResult);
}
/// <summary> /// <summary>
/// Refreshes the authentication token using the existing refresh token. /// Refreshes the authentication token using the existing refresh token.