Exemple #1
0
        public ActionResult Recover(RecoverViewModel viewModel)
        {
                if (string.IsNullOrWhiteSpace(viewModel.Email))
                {
                    TempData[RecoverValidationSummaryKey] = T("You did not provide a valid email.").ToString();
                }
                else
                {
                    if (_userService.VerifyUserUnicity(viewModel.Email, viewModel.Email))
                    {
                        TempData[RecoverValidationSummaryKey] = T("Oops, this email address is not registered!").ToString();
                    }
                    else
                    {
                        var siteUrl = _workContextAccessor.GetContext().HttpContext.Request.Url;
                        _userService.SendLostPasswordEmail(viewModel.Email, nonce =>
                            new Uri(siteUrl, Url.Action("ResetPassword", "Account", new { area = "Teeyoot.Account", nonce }))
                                .ToString());
                    
                    TempData[RecoverEmailSentKey] = true;
                    }
                }

            return this.RedirectLocal("~/Recover");
        }
Exemple #2
0
        public ActionResult Recover()
        {
            var viewModel = new RecoverViewModel();

            if (TempData[RecoverValidationSummaryKey] != null)
            {
                viewModel.RecoverFailed = true;
                viewModel.RecoverIssueSummary = (string) TempData[RecoverValidationSummaryKey];
            }

            if (TempData[RecoverEmailSentKey] != null)
            {
                viewModel.RecoverEmailSent = (bool) TempData[RecoverEmailSentKey];
            }

            return View(viewModel);
        }