fix: return bool instead

This commit is contained in:
Polianin Nikita 2024-11-02 22:09:40 +03:00
parent 1b24954c3e
commit 6831d9c708

View File

@ -41,7 +41,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
GetCookieParams(),
new User
{
Id = 1,
Id = 1.ToString(),
Username = userEntity.Username,
Email = userEntity.Email,
PasswordHash = userEntity.PasswordHash,
@ -56,10 +56,10 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
[HttpPost("2FA")]
[BadRequestResponse]
public async Task<ActionResult<TwoFactorAuthentication>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request)
public async Task<ActionResult<bool>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request)
{
var tokenResult = await auth.LoginAsync(GetCookieParams(), HttpContext, request.Method.ConvertFromDto(), request.Code);
return Ok(tokenResult ? TwoFactorAuthentication.None : TwoFactorAuthentication.TotpRequired);
return Ok(tokenResult);
}
/// <summary>