public void Check_Email_Is_Valid(string email) { var forgotPasswordDto = new ForgotPasswordDTO { Email = email }; forgotPasswordDto.Validate(); Assert.IsTrue(forgotPasswordDto.Valid); }
public void Check_Email(string email) { var forgotPasswordDto = new ForgotPasswordDTO(); Assert.IsNull(forgotPasswordDto.Email); forgotPasswordDto.Email = email; Assert.AreEqual(email, forgotPasswordDto.Email); forgotPasswordDto.Validate(); Assert.IsTrue(forgotPasswordDto.Invalid); }
public async Task <IActionResult> ForgotPassword( [FromServices] IAuthenticationService _services, [FromBody] ForgotPasswordDTO forgotPasswordDTO) { forgotPasswordDTO.Validate(); if (forgotPasswordDTO.Invalid) { return(BadRequest(new ResultDTO(false, "Wrong email, please verify and try again.", forgotPasswordDTO.Notifications))); } var result = await _services.ForgotPassword(forgotPasswordDTO); if (result.Success == false) { return(BadRequest(result)); } return(Ok(result)); }