public Result ForgotPassword(MemberForgotPasswordDto dto, out Member member) { member = null; var validator = new MemberForgotPasswordValidator(); var result = validator.ValidateResult(dto); if (!result.Success) { return(result); } result = ForgotPasswordResponse(dto.Email); member = _memberRepository.AsNoTracking .FirstOrDefault(w => w.IsActive && w.Email == dto.Email); if (member != null) { member = new Member() { Name = member.Name, Email = member.Email, ForgotPasswordToken = GenerateAndSaveForgotPasswordToken(member) }; } return(result); }
public JsonNetResult ForgotPassword(MemberForgotPasswordDto dto) { var result = _memberService.ForgotPassword(dto, out var member); if (member != null) { new EmailService(_emailTemplateService, _appSettings).SendMemberForgotPasswordEmail(member); } if (!result.Success) { return(new JsonNetResult(result)); } result.IsRedirect = true; result.SetRedirect("login"); result.Clear(); return(new JsonNetResult(result)); }