public async Task <UserPasswordForgotResponseDto> PasswordForgot(UserPasswordForgotRequestDto requestDto) { var user = await _userRepository.GetByEmail(requestDto.Email); if (user == null) { return(new UserPasswordForgotResponseDto { Error = ErrorCodes.UserEmailNotExists, ErrorField = new List <string> { nameof(requestDto.Email) } }); } var res = await _codeRepository.Create( new CodeModel { UserId = user.Id, Code = _codeService.GenerateCode(6), ReasonId = CodeReason.PasswordForgot, DateExpiration = new DateTime().Add(new TimeSpan(0, 0, 30)) }, user.Id.Value ); //TODO email send return(new UserPasswordForgotResponseDto()); }
public async Task <ActionResult> PasswordForgot([FromBody] UserPasswordForgotRequestDto requestDto) { await _authenticateService.PasswordForgot(requestDto); return(Ok()); }