Пример #1
0
        public ActionResult RecoverPassword(RecoverPasswordViewModel model, string email)
        {
            if (ModelState.IsValid)
            {
                //sends a password recovery email if the account exists in the system
                email = model.email;
                Account account = accountDAO.FetchByEmail(email);
                if (account != null)
                {
                    if (account.emailVerified)
                    {
                        emails.PasswordRecoveryEmail(account.email, account.email);
                        TempData["successMessage"] = "An email has been sent to you!";
                        return(RedirectToAction("Recoverpassword", "Account"));
                    }
                    else
                    {
                        emails.SendEmailAddressVerificationEmail(account.email, account.email);
                        TempData["errorMessage"] = @"The email you provided was correct 
                                but your email address has not yet been verified.  
                                We just sent another email verification email to you.  
                                Please follow the instructions in that email.";
                    }
                }
                else
                {
                    TempData["errorMessage"] = @"We could not find that email !
                                                 contact customer service on [email protected] 
                                                 if you need more help";
                }
            }

            return(View(model));
        }
Пример #2
0
        public ActionResult RecoverPassword(RecoverPasswordViewModel model, string email)
        {
            if (ModelState.IsValid)
            {
                email = model.email;
                Account account = accountDAL.FetchByEmail(email);

                if (account != null)
                {
                    if (account.isVerified == true)
                    {
                        _email.PasswordRecoveryEmail(account.email, account.email);
                        TempData["successMessage"] = @"An email has been sent to you.";
                        return(RedirectToAction("RecoverPassword"));
                    }

                    else
                    {
                        _email.SendEmailAddressVerificationEmail(account.email, account.email);
                        TempData["errorMessage"] = @"The email you provided was correct 
                                but your email address has not yet been verified.  
                                We just sent another email verification email to you.  
                                Please follow the instructions in that email.";
                    }
                }

                else if (account == null)
                {
                    TempData["errorMessage"] = "That email does not exist.";
                }
            }
            return(View(model));
        }