sec: transfer user verification to the appropriate service

This commit is contained in:
2024-12-22 05:13:46 +03:00
parent 5cc54eac44
commit f2e79e51f2
2 changed files with 6 additions and 9 deletions

View File

@ -164,10 +164,6 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
{
var userEntity = user.Value;
if (!userEntity.Username.Equals(request.Username, StringComparison.OrdinalIgnoreCase) &&
!userEntity.Email.Equals(request.Username, StringComparison.OrdinalIgnoreCase))
return Unauthorized("Authentication failed. Please check your credentials.");
var tokenResult = await auth.LoginAsync(
GetCookieParams(),
new User
@ -181,7 +177,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
SecondFactorToken = userEntity.Secret,
OAuthProviders = userEntity.OAuthProviders
},
HttpContext, request.Password);
HttpContext, request.Password, request.Username);
return Ok(tokenResult.ConvertToDto());
}