public void CheckUserPassword(int userId, UserPasswordCheckModel model) { // validation var results = _userValidator.Validate(model.Password).ToArray(); if (results.Length > 0) { throw new ValidationApiException(results); } User entity = _repo.GetUser(userId); if (entity == null) { throw new NotFoundApiException("User does not exist"); } if (entity.Password != model.Password) { throw new CheckPasswordApiException("Old password is incorrect"); } }
public IActionResult CheckUserPassword(int userId, UserPasswordCheckModel model) { _userService.CheckUserPassword(userId, model); return(NoContent()); }