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