Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CoskunKurtuldu/b357bc1f87101b1e3ed51aee2510a9fd to your computer and use it in GitHub Desktop.
Save CoskunKurtuldu/b357bc1f87101b1e3ed51aee2510a9fd to your computer and use it in GitHub Desktop.
[HttpPost("SignIn")]
public async Task<IActionResult> SignIn(UserLoginDTO userLoginDto)
{
var user = _userManager.Users.SingleOrDefault(u => u.UserName == userLoginDto.Email);
if (user is null)
{
return NotFound("User not found");
}
var userSigninResult = await _userManager.CheckPasswordAsync(user, userLoginDto.Password);
if (userSigninResult)
{
return Ok();
}
return BadRequest("Email or password incorrect.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment