コード例 #1
0
        public void Check_Email_Is_Valid(string email)
        {
            var forgotPasswordDto = new ForgotPasswordDTO {
                Email = email
            };

            forgotPasswordDto.Validate();
            Assert.IsTrue(forgotPasswordDto.Valid);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }